fnFilterAll plugin possible bug
fnFilterAll plugin possible bug
I think you need to add jQuery.fn.dataTableExt.iApiIndex = 0; after the forloop.
[code]
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bEscapeRegex) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnFilter(sInput, iColumn, bEscapeRegex);
}
jQuery.fn.dataTableExt.iApiIndex = 0;
}
[/code]
If I don't do that, at some later point I get "Uncaught TypeError: Cannot read property 'aoData' of null" at some point after when I try to do something to the multitable selector for example: oTables.fnSort([]);
Just to explain what I'm doing that causes the above error:
1) I initialize one or more (up to 10) empty tables of the same type of data on a page.
2) Using ajax calls get data to populate the tables.
3) After each row is added I filter and sort the tables based on a series of checkbox filters.
I was using fnFilter on a $('.tableclass).dataTable() but realized that was only applying the filter to the first table. Changing to fnFilterAll started causing the page not to load past the first table with the above error. Resetting the iApiIndex seems to have fixed that.
[code]
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bEscapeRegex) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnFilter(sInput, iColumn, bEscapeRegex);
}
jQuery.fn.dataTableExt.iApiIndex = 0;
}
[/code]
If I don't do that, at some later point I get "Uncaught TypeError: Cannot read property 'aoData' of null" at some point after when I try to do something to the multitable selector for example: oTables.fnSort([]);
Just to explain what I'm doing that causes the above error:
1) I initialize one or more (up to 10) empty tables of the same type of data on a page.
2) Using ajax calls get data to populate the tables.
3) After each row is added I filter and sort the tables based on a series of checkbox filters.
I was using fnFilter on a $('.tableclass).dataTable() but realized that was only applying the filter to the first table. Changing to fnFilterAll started causing the page not to load past the first table with the above error. Resetting the iApiIndex seems to have fixed that.
This discussion has been closed.
Replies
Regards,
Allan
[code]
$.fn.dataTableExt.oApi.fnSortAll = function(oSettings, sInput) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnSort(sInput);
}
jQuery.fn.dataTableExt.iApiIndex = 0;
}
[/code]
and
[code]
$.fn.dataTableExt.oApi.fnSetColumnVisAll = function(oSettings, iColumn, bVisible) {
for (var i in this.dataTableSettings) {
jQuery.fn.dataTableExt.iApiIndex = i;
this.fnSetColumnVis(iColumn,bVisible);
}
jQuery.fn.dataTableExt.iApiIndex = 0;
}
[/code]