Bug in adding row after filtering
Bug in adding row after filtering
jacksumit
Posts: 4Questions: 0Answers: 0
Hi Allan
I am extensively using datatable in my project and for that i am also going through your code. I would like to congratulate you for making such a wonderful plugin.
One more bug that I came around
Call fnFilter with bEscapeRegex set to 0. that means i will call like
oTable.fnFilter("^(sumit)|^(amit)",1,0)
then add some row using fnAddData(array) and check what happens. no record will be shown in table even not those which satisfies the above search criteria.
Reason for bug
fnAddData calls _fnReDraw which calls _fnFilterComplete
In _fnFilterComplte we call _fnFilterColumn. In this call we use oSettings.asPreSearchCols[i] as our sInput but we neglected what type of search it was (bEscapeRegex=0 or 1).
so it calls _fnFilterColum(oSettings,("^(sumit)|^(amit)",1,true); for i=1
Solution that I implemented
Store type of search in an array in oSettings (oSettings.asPreSearchColsType[i]) when fnFilter is called similar to storing oSettings.asPreSearchCols[i].
Use this oSettings.asPreSearchColsType[i] in call to _fnFilterColum.
Same case may arise for call to _fnFilter in _fnFilterComplete, so we also need to store type of oSettings.sPreviousSearch.
I am extensively using datatable in my project and for that i am also going through your code. I would like to congratulate you for making such a wonderful plugin.
One more bug that I came around
Call fnFilter with bEscapeRegex set to 0. that means i will call like
oTable.fnFilter("^(sumit)|^(amit)",1,0)
then add some row using fnAddData(array) and check what happens. no record will be shown in table even not those which satisfies the above search criteria.
Reason for bug
fnAddData calls _fnReDraw which calls _fnFilterComplete
In _fnFilterComplte we call _fnFilterColumn. In this call we use oSettings.asPreSearchCols[i] as our sInput but we neglected what type of search it was (bEscapeRegex=0 or 1).
so it calls _fnFilterColum(oSettings,("^(sumit)|^(amit)",1,true); for i=1
Solution that I implemented
Store type of search in an array in oSettings (oSettings.asPreSearchColsType[i]) when fnFilter is called similar to storing oSettings.asPreSearchCols[i].
Use this oSettings.asPreSearchColsType[i] in call to _fnFilterColum.
Same case may arise for call to _fnFilter in _fnFilterComplete, so we also need to store type of oSettings.sPreviousSearch.
This discussion has been closed.
Replies
Regards,
Allan