ColumnControl won't keep state of search if two searches are present
ColumnControl won't keep state of search if two searches are present
Description of problem:
Hello guys,
my scenario is that I'm building a datatable with columncontrol (and much other extensions)
with this cc in the init stage:
columnControl: [
{
target: 0,
content: [
'order',
['orderAsc', 'orderDesc', 'orderAddAsc', 'orderAddDesc', 'orderRemove', 'orderClear', 'spacer', 'reorderLeft', 'reorderRight', 'spacer', 'search', 'searchList']
]
},
{
target: 1,
content: ['search'],
className: 'dt-header-columnssearch'
}
]
What I'm doing is hiding the second row and toggle it with a button (let's call that row - Quick Search)
and on the table header I did like a "Column Menu" with much stuff there.
now, one more thing is that -
when clicking on a datatable row it opens a modal dialog which has a callback.
on the callback I save a state using state restore extension then refreshing the page and loading the state i saved. let's call this action "Editing".
the problem is this.
1. When toggling the Quick Search and doing a search there, and then Editing, the state restored with the search and the table is filtered accordingly
2. When searching using the search in the column menu and then editing, it won't save the search nor will filter the table and it's like it resets the table
I need to fix that when using the search inside the Column Menu it will restore good after the refresh.
bonus question - is there a way to sync these searches inputs?
Thank you very much for the help in advance!
Answers
Hi,
I'm afraid you are right. At the moment, duplicating
searchis going to cause problems for the state, as only a single object is used for that state, rather than an array. I'm afraid that is a limitation of ColumnControl as it currently stands.Allan
No worries. thank you for replaying and sorry it took me ages to replay myself.
Is there any direction you can think of I might be able to utilize callbacks or other functions to get the state and set everything right?
For two different search inputs supported with state saving? You'd need to modify ColumnControl for it to be able to do that.
This is the part to look at, at least for the basic search
inputtypes. There would need to be a unique id per input (the header display row index perhaps?) so it can be referred to again on reload.Allan