Closed mpdas108 closed 4 years ago
thx, but please add this fix only in src folder
I have added to only the src folder now.
@mpdas108 b.t.w, what issue exactly does the previous undefined check introduced?
This problem is only applicable to those using server side filtering, and trying to reset all the filters using yadcf.exResetAllFilters()
function. Resetting the filters one by one, works as intended.
settingsDt.aanFeatures.f
is not properly seen as undefined so the conditional statement returns true when it should return false. This causes the script to wrongly enter the conditional block and the script produces an error visible in the console when trying to execute the next line which tries to check the length of settingsDt.aanFeatures.f
:
for (i = 0; i < settingsDt.aanFeatures.f.length; i++) {
,
The error is thrown then because settingsDt.aanFeatures.f
is actually undefined. The result of this error is that the filters are physically reset, but the server is not queried again for results, leaving an empty table.
but typeof should be checked against 'undefined' (wrapped with an apostrophe) ?
My mistake, in my live version I do have quotes. I forgot them in my local version that I used to submit the PR.
I also understand that variable === undefined
, and variable !== undefined
should work. but for some reason I kept getting undefined errors, meaning the if (settingsDt.aanFeatures.f !== undefined) {
was failing to detect undefined.
I added the quotes.
Thanks for the fix,
I guess it happened because in your scenario f
was not declared in settingsDt.aanFeatures.f
Discovered this issue when trying to reset filters on a server side implementation.