Datatables 2 data attributes processing change

Datatables 2 data attributes processing change

scoldwellscoldwell Posts: 3Questions: 0Answers: 0
edited April 26 in Free community support

Link to test case:
Datatables 1.x: https://live.datatables.net/mibekuvo/1/edit
Datatables 2.x: https://live.datatables.net/xoyahanu/1/edit

Description of problem:
In datatables 1.x we were able to specify data attributes in the html that would get processed prior to stateLoadCallback being triggered. This has changed in datatables 2.x as shown in the test cases' console output. This makes it really difficult to execute logic needed for loading the state that is dependent on any data attributes that may be specified on the column headers. In addition, the header() method on the column throws an error if called in stateLoadCallback. I have found some ugly workarounds (by getting the table node and using css selectors to get the header nodes), but this is not ideal.

Replies

  • allanallan Posts: 61,984Questions: 1Answers: 10,162 Site admin

    Interesting one. That wasn't an intention coming out of the change that was made in that area. I'll need to make some time to see if I can rectify it. I'll try to do so next week. Thanks for flagging this up.

    Allan

  • scoldwellscoldwell Posts: 3Questions: 0Answers: 0

    Thanks, Allan!

  • scoldwellscoldwell Posts: 3Questions: 0Answers: 0

    Would you like me to write up an issue in github?

  • allanallan Posts: 61,984Questions: 1Answers: 10,162 Site admin

    No - just here is fine thank you. No need for duplication :)

    Allan

  • allanallan Posts: 61,984Questions: 1Answers: 10,162 Site admin

    I've just committed a change as a result of my investigation into the issue you highlighted here.

    It isn't a trivial change as you'll see, so I'm going to release this as part of 2.1 rather than an upcoming 2.0.x release. It reorders things internally and I'm not comfortable with it as a patch release, just in case. The unit tests are all passing with the test, but as seen, I've already missed something in this area.

    I also want to spend some time making further improvements in this area, and formalising the loading sequence a bit more so this kind of mistake doesn't happen again. In that vain, I've still to add unit tests for this change as well.

    I'm not yet sure with 2.1 will happen - perhaps a few months time. There are a few other things I need to work on first. You could if you wanted build from the 2.1 branch, or I can send you a built copy of it if you would like to try these changes out.

    Regards,
    Allan

Sign In or Register to comment.