I've been working with DataTables, scrollX, and server-side data sourcing, and have hit a couple of obstacles. The basic symptom is that the column headers do not align with the data columns, and in chasing that down, I learned....
1) The column-sizing gets done before the first data is loaded, so can't actually base size on data cell size. Calling .fnAdjustColumnSizing() after data loading would seem to correct this, but it is not obvious where to hook the method call. Putting the call in the callback of fnServerData seems to cause repeated calls to fnServerData. I put it in a test-and-set once-only block, but I am not sure that is optimal.
2) When the columns do get sized, the size of the header label does not seem to be included in the calculation, so if it is larger than the data, the header th is oversized, compared to the data.
The demo site is at: http://bb.noservercoding.net
DataTables has, otherwise, been wonderful to work with, and I keep finding more and more handy features. The scrollX feature was a relief to find, as the alternatives I could think of were difficult. Thank you.
1) The column-sizing gets done before the first data is loaded, so can't actually base size on data cell size. Calling .fnAdjustColumnSizing() after data loading would seem to correct this, but it is not obvious where to hook the method call. Putting the call in the callback of fnServerData seems to cause repeated calls to fnServerData. I put it in a test-and-set once-only block, but I am not sure that is optimal.
2) When the columns do get sized, the size of the header label does not seem to be included in the calculation, so if it is larger than the data, the header th is oversized, compared to the data.
The demo site is at: http://bb.noservercoding.net
DataTables has, otherwise, been wonderful to work with, and I keep finding more and more handy features. The scrollX feature was a relief to find, as the alternatives I could think of were difficult. Thank you.