Regression in DataTables 1.10.1 - Column-based searching.

Regression in DataTables 1.10.1 - Column-based searching.

remyjetteremyjette Posts: 7Questions: 1Answers: 0

This commit https://github.com/DataTables/DataTablesSrc/commit/cd5a8720501366cd820add82beb0cd701b119a1f has caused a regression in DataTables 1.10.1.

The filterData.push( cellData ); line is now within the "if ( cellData )" check. As a result, if a cell contains a falsy value (such as 0), it is not added to _aFilterData. When doing column-based searching, this causes the indexes of _aFilterData to not match the indexes from aoColumns, and so a search occurs on the wrong column.

Please see this DataTables Live page for an example: http://live.datatables.net/mohewak/2/edit

Replies

  • remyjetteremyjette Posts: 7Questions: 1Answers: 0
    edited July 2014

    I've submitted a pull request for a fix that worked in my project, which was to unconditionally push cellData to filterData for every column so that the indexes between the two arrays stay aligned (which is how it worked before the commit named above).

    See https://github.com/DataTables/DataTablesSrc/pull/10

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Darn - thanks for flagging this up. I'll take a look into it just now.

    Regards,
    Allan

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    I've just committed a fix for this and included a test case which will catch this should I do something daft like that in future.

    This is a fairly nasty little bug, so I'm going to release 1.10.2 fairly soon I think (give a chance for anything else to crop up out of the wood work first)!

    Regards,
    Allan

  • remyjetteremyjette Posts: 7Questions: 1Answers: 0

    Excellent, thank you! Looking forward to the release - kudos on a great piece of software!

This discussion has been closed.