Sorting data with colspan header

Sorting data with colspan header

mrdatatablemrdatatable Posts: 2Questions: 0Answers: 0
edited October 2011 in General
Hi,

I have a table with 9 columns. The first two columns contain a text and an icon. In the header I only want to use one titel for both, so I used colspan="2". But now, it isn't possible to sort this column. The proberty "aaSorting" is working (it looks like :)).

There are any possibilities to sort the first column?

Thx

I'm using the newest Version 1.8.2.

Replies

  • mrdatatablemrdatatable Posts: 2Questions: 0Answers: 0
    can anybody help me, please? Is it possible to sort the columns or not with colspan?
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Col span does indeed mess up your header. Col span in general is not supported in DataTables, but it is allowed in the header; it's intended to allow you to specify multiple rows where one row has no colspan (has a cell for each column, this would be where the sort handler is attached) while another row that has colspan could be used to visually group some of your columns.

    Here is the example page that uses colspan in this way (cols 2, 3, and 4 are grouped as "Details"):
    http://www.datatables.net/release-datatables/examples/basic_init/complex_header.html

    Because you're trying to use this feature for a different purpose, you might have to manually attach a listener to that column in order to get the sorting working again. It should be a matter of using a function like jQuery's .click() to attach a sort listener.
This discussion has been closed.