Populate Filter From Link
Populate Filter From Link
Hello --
I was wondering if it would be possible to pre-populate the filter text of a datatable based on a parameter passed in the url of the page. ie something like http://www.datatables.net/pagewithtable/Test would load the page with the Search bar already searching for the string "Test". Alternatively, is it possible to populate the filter text by clicking on a cell in the datatable? As in, a table cell contains the text "Test" and clicking on "Test" causes the text "Test" to appear in the search bar and begin searching.
I really hope this isn't a repeated question, I previously attempted searching for similar questions and example files, but haven't had any luck finding something like this. But I apologize if I overlooked something.
An Update --
I figured out, that with a link and FnFilter, I can do something like:
[code]
[/code]
For Links -- and This helps catch things externally
[code]
if(window.location.hash) {
oTable.fnFilter(window.location.hash.substring(1));
}
[/code]
All set -- this topic may be closed unless there is a more proper way to do this. Sorry!
I was wondering if it would be possible to pre-populate the filter text of a datatable based on a parameter passed in the url of the page. ie something like http://www.datatables.net/pagewithtable/Test would load the page with the Search bar already searching for the string "Test". Alternatively, is it possible to populate the filter text by clicking on a cell in the datatable? As in, a table cell contains the text "Test" and clicking on "Test" causes the text "Test" to appear in the search bar and begin searching.
I really hope this isn't a repeated question, I previously attempted searching for similar questions and example files, but haven't had any luck finding something like this. But I apologize if I overlooked something.
An Update --
I figured out, that with a link and FnFilter, I can do something like:
[code]
[/code]
For Links -- and This helps catch things externally
[code]
if(window.location.hash) {
oTable.fnFilter(window.location.hash.substring(1));
}
[/code]
All set -- this topic may be closed unless there is a more proper way to do this. Sorry!
This discussion has been closed.