Column filter in cloned header.

Column filter in cloned header.

JamesHolsonJamesHolson Posts: 2Questions: 1Answers: 0

Link to test case: https://live.datatables.net/vetuhule/8/edit?js,console,output
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I've recently updated from datatables 1.10 to 2. For column filtering I have cloned the header and used orderCellsTop to prevent it from sorting when clicked.

Now with version 2 I see that orderCellsTop is deprecated and the alternative is using data-dt-order="disable", however for some reason the api columns() returns the cloned column instead of the original. In the linked test case you can see a very simple representation of the problem, if you replace the .attr('data-dt-order', 'disable') with orderCellsTop: true it will work as intended.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    edited December 20 Answer ✓

    personally I would continue using orderCellsTop if it works in my solution. @allan has this comment in this thread.

    I've got orderCellsTop marked as deprecated at the moment - I'm reviewing that decision! It is useful at times

    You may need to make changes at some point if its removed. Hopefully we can talk Allan into keeping the option. I find it useful at times too.

    You can control the row the column().title() fetches the title from by passing in the row parameter. Updated test case showing this:
    https://live.datatables.net/vetuhule/14/edit

    Kevin

  • JamesHolsonJamesHolson Posts: 2Questions: 1Answers: 0

    That will do it, thanks for the help.

Sign In or Register to comment.