ColReorder problem

ColReorder problem

gammonsgammons Posts: 0Questions: 0Answers: 0
edited January 2012 in Bug reports
Hi there.

First off, I'm finding the DataTables plugin to be fantastic overall.

I'm running into a problem now where I have a setup nearly identical to one of the ColReorder examples, specifically this one (http://www.datatables.net/release-datatables/extras/ColReorder/col_filter.html)

In my tests, i've created a trivial table that has two rows in the element, just like the example. However, this is causing ColReorder to bind to the 2nd , and it's causing javascript problems (see screenshot below).

fortunately (for testability purposes) this *exact* error is also occurring in the ColReorder example! The columns are *not* re-orderable at all!

The attached screenshot is firebug output after attempting to re-order the 2nd row:
https://s3.amazonaws.com/uploads.hipchat.com/514/18529/dxflli4gkx59yl6/Screen%20Shot%202012-01-27%20at%2012.30.56%20PM.png

Thanks in advance for any help! much appreciated!

Replies

  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    I've tried just having two TR elements in the header, but it appears to work okay for me: http://live.datatables.net/epejuv/edit . Can you link me to your example that isn't working please?

    Allan
  • gammonsgammons Posts: 0Questions: 0Answers: 0
    Hi Allan,

    Using your JSBin example, only the 2nd row is draggable, and not the top row. That's the main issue I am having. I would expect both rows (or just the top row) to be draggable.

    -Grant
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Ah I see! ColReorder only attaches itself to the cells which have the sort listener attached to them: https://github.com/DataTables/ColReorder/blob/master/media/js/ColReorder.js#L458 .

    Perhaps in this case what you want to do is use the bSortCellsTop flag to have the sort and reorder events attached to the top cells in the column header and have the filters below as per your picture.

    Allan
  • gammonsgammons Posts: 0Questions: 0Answers: 0
    Thank you Allan! Works perfectly now ;)
This discussion has been closed.