0

I'm using YADCF plugin for datatables and I'm using exResetAllFilters to reset all column filters but it doesn't work.

I have done an example using Jsfiddle. Using Firebug I can see the error:

TypeError: string is undefined

return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);

I have changed this function in the YADCF library and also generateTableSelectorJQFriendly to check if string is empty.

function replaceAll(string, find, replace) {
    if (string) {
        return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
    }
    else {
        return string;
    }
}

function generateTableSelectorJQFriendly(tmpStr) {
    if (tmpStr) {
        tmpStr = replaceAll(tmpStr, ".", "-");
        tmpStr = replaceAll(tmpStr, ' ', '');
        return tmpStr.replace(":", "-").replace("(", "").replace(")", "").replace("#", "-");
    }
    else {
        return tmpStr
    }
}

After these changes I see a different error

TypeError: table_arg.fnDraw is not a function

table_arg.fnDraw(settingsDt);

How can I fix it?

Ad23
  • 106
  • 1
  • 7

1 Answers1

1

The issue in jsfiddle was just a jsfiddle issue related to its wrapping way,

I have solved it by using .click instead of dom onclick (I did so only because its jsfiddle - in a normal web app you can use onclick without any problems) , see working jsfiddle, if you have any other issue that can be reproduced feel free to ask

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200