Server processing: quirky assumption about columns during reordering

Server processing: quirky assumption about columns during reordering

CloudStrifeCloudStrife Posts: 6Questions: 0Answers: 0
edited April 2011 in Bug reports
I've found an issue in datatables 1.7.5 using server side processing.

In one case I modified the server to return more columns in aaData than the table has. I found that this screwed up the table by displaying the wrong data in some columns. I investigated and found that the reordering step assumes that the server isn't returning more columns than the table has. In the line that looks like this:

for ( var j=0 ; j

Replies

  • CloudStrifeCloudStrife Posts: 6Questions: 0Answers: 0
    Allan, ping... do you think this can make it next time you release? :)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited May 2011
    This is in the _fnReOrderIndex() function is it? The reason it is the way it is, is that I expected that the server would always return exactly the number of columns that are in the table - this concept is assumed in a number of places in the code.

    Having said that, in DataTables 1.8 this idea is relaxed significantly by the new mDataProp property for columns. With this you can specify an array index or object property to use for a column, regardless of the array or object's size. Have a look at this post for more information: http://datatables.net/blog/Extended_data_source_options_with_DataTables . This effectively depreciates the concept of reordering columns for a source array since it is no longer strictly needed.

    I'd encourage you to have a look at the 1.8 betas and give it a go with mDataProp as I think this will work better for you in the long run as it is "baked" into the DataTables core, rather than working around an old assumption.

    Regards,
    Allan
This discussion has been closed.