stateSave load values not working in fixedcolumns filters
stateSave load values not working in fixedcolumns filters

Hello, I have a table with multiple filters and to not lose the filters I use the stateSave option, it works correctly in the inputs that are not in fixedcolumns, how do I load the value in the inputs that are within fixedcolumns?
This is my code:
var table = $ ("#ajaxtable").DataTable();
var state = table.state.loaded();
if (state) {
table.columns (). eq (0).each (function (colIdx) {
var colSearch = state.columns [colIdx] .search;
$ ('# search _' + colIdx). val (colSearch.search); // this works less with the fixed columns
});
table.draw ();
}
the input boxes:
$('#ajaxtable thead tr:eq(1) th').each( function (i) {
$(this).html( '<input data-thindex='+i+' class="filter" type="text" style="width:100%;" id='+"search_"+i+' />' );
});
the options:
var options ={
order:[],
"data": data,
"orderCellsTop": true,
"deferRender": true,
"processing": true,
"stateSave": true,
"sScrollY": calcDataTableHeight(),
fixedColumns: (windowsize > 800 ? {leftColumns: fixleft,rightColumns: fixright} : undefined),
"paging": true,
"scrollX": true,
"columns":columns,
"select": {
style: 'single'
},
"dom": dom_tables,
buttons: []
}
Replies
Hi @MathBarlow ,
This thread should help, it's asking the same thing. If it doesn't, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Hello Colin, according to the request, I decided to make the code by the live editor of datatables with the examples found on the web page, the problem is that it does not set the search value in the text boxes that are in fixedcolumn (when the page is updated), in this example the fields: Firstname and Email, the link:
live.datatables.net/golahece/1/edit
Hi @MathBarlow ,
The FixedColumn extension places a layer above the table, so you have to place the value into the input cells in that layer. See your example modified here.
Cheers,
Colin
Hello Collin
Perfect!, a million thanks you saved me!, this helps me a lot, you can close this discussion, if this is necessary.