I integrated on my application, datatables, to give more functionalities to my HTML tables. It works correctly, however, when I want to perform a search, through an input, I would like to save the state of the table, at the page change, but also the associated filter, in the input. To do this, here is the code that works (provided that it is put in each HTML file containing a table):
stateSaveParams: function( settings, data ) {
data.**col1_filter** = $('#**col1_filter**').val()
},
stateLoadParams: function( settings, data ) {
$('#**col1_filter**').val(data.**col1_filter**)
},
What I want to do now, is to generalize this code, within a "script.js" file, so that the next time I create a table, I just have to apply the "datatable" class, and everything is done directly.
My question is : how can I specify the name of the input field, for "stateSaveParams" and "stateLoadParams", instead of mentioning in hardcopy the name of the field (which is not named the same each time) ?
Thank you very much in advance, I want to specify, that I did not find a solution, despite my multiple searches, before this post.