datatables How to get the search value entered in Datatables programmatically? Example


This is the code to filter the Datatables [1.10.7] by value programmatically, you can find it on official documentation.

function setFilterValue(datatable, value){
    if(datatable !== undefined){

This is the code to get the value by the previous search.

function getFilterValue(datatable){
    var value;
    if(datatable !== undefined){
        value = datatable
    return value;

This approach is useful when you have the cache active ("stateSave": true) and you need to know the previous search value after reloaded the page.