devxlogo

Placing Multiple Headers in a DataTable

Placing Multiple Headers in a DataTable

A DataTable can only handle one header for each column. The workaround for this is to use two tables. Generate the first table at the same time as the DataTable and the other one using HTML. The HTML table will contain the headers, however many you desire.

Next, align the columns from the two tables using CSS. For each column, create a class style and specify the width:

DIV.columnX{  background: none;  width: 95px;  text-align: left; }

This looks fine on all browsers.

devx-admin

Share the Post: