Local storage problem retrieving column filtering with hidden columns

Local storage problem retrieving column filtering with hidden columns

EricEric Posts: 24Questions: 0Answers: 0
edited November 2013 in General
I've tried searching and can't seen to find the answer anywhere. I'm referencing this post: http://datatables.net/forums/discussion/2864/x#Item_3

I'm using local storage, individual column filtering, and hide/show columns (ColVis). An example below on how to retrieve the values saved.

[code]
var oTable = $('#example').dataTable( {
"oLanguage": {
"sSearch": "Search all columns:"
},
"bStateSave": true,
"fnInitComplete": function() {
var oSettings = $('#example').dataTable().fnSettings();
for ( var i=0 ; i0){
$("tfoot input")[i].value = oSettings.aoPreSearchCols[i].sSearch;
$("tfoot input")[i].className = "";
}
}
}
} );
[/code]

The problem is the hidden columns, this will throw off if I'm filtering on more than one column because not all columns are shown, and there might not be an input for every column.

How can I retrieve (in my case, thead) the correct input fields?

I tried doing something like this: (_fnVisibleToColumnIndex)

[code]

"fnInitComplete": function() {
var oSettings = $('#example').dataTable().fnSettings();
for ( var i=0 ; i0){
$("tfoot input")[index].value = oSettings.aoPreSearchCols[i].sSearch;
$("tfoot input")[index].className = "";
}
}
}


[/code]

Any ideas?

Replies

  • EricEric Posts: 24Questions: 0Answers: 0
    Or, if I can't figure this out, how to best keep column filtering from saving in local storage? (via the fnStateSave)
This discussion has been closed.