Colreorder, Ajax, and bStatesave?

Colreorder, Ajax, and bStatesave?

dittoditto Posts: 6Questions: 0Answers: 0
edited February 2011 in Bug reports
Does anyone have these three working together nicely with 1.7.5? It seems whenever I re-arrange columns all works as expected. It's when the page is reloaded there is an issue. The columns stay in their (correct) re-arranged order but the data gets loaded in the original order so it doesn't match up.

Replies

  • allanallan Posts: 62,156Questions: 1Answers: 10,192 Site admin
    Hi ditto,

    Are you using sNames in your initialisation? Also when you say Ajax, do you mean server-side processing or just Ajax data loading for client side processing? There might indeed be a limitation in the code for the latter at the moment. I'll have a look at addressing that.

    Allan
  • dittoditto Posts: 6Questions: 0Answers: 0
    Sorry, Ajax client side. I tried sNames but it seemed to make no difference and the documentation says it's for server side only.
  • allanallan Posts: 62,156Questions: 1Answers: 10,192 Site admin
    Yes indeed - the documentation is correct there. I'm afraid you've found a limitation in the current code :-(. I hadn't anticipated that the Ajax sourced data might be 'out of order' - but of course with ColReorder that is perfectly reasonable. There is an interaction there that I hadn't taken account of - sorry.

    I will look at addressing this as soon as I can.

    Regards,
    Allan
  • mfrancismfrancis Posts: 1Questions: 0Answers: 0
    Has this been fixed? I now see when the page reloads the columns align correctly, but when I sort, or go to page 2,3... they go back to the default order that is returned from the server-side JSON array.
  • jeremysoltjeremysolt Posts: 1Questions: 0Answers: 0
    I have also run into this, I suppose if there was a way to figure out what the current column is supposed to be the data could be returned that way, that would be helpful.
  • allanallan Posts: 62,156Questions: 1Answers: 10,192 Site admin
    edited May 2012
    Agreed - I'm going to be looked at making exactly this kind of thing much easier in 1.10. Until then you could use the sName option and then loop over the fnSettings().aoColumns array of objects looking for the sName option (which is what I will be abstracting out in 1.10).

    The other thing to say is to use objects for your data source and mDataProp in DataTables - that way order is made irrelevant: http://datatables.net/blog/Extended_data_source_options_with_DataTables

    Allan
This discussion has been closed.