Dynamic data in searchbox

Dynamic data in searchbox

PareshBafnaPareshBafna Posts: 16Questions: 1Answers: 0
edited May 2020 in Free community support

Hi,
How can i enter dynamic data in searchbox?
I have to use double quotes and static value to make it work. Is it possible to use dynamic data without quotes?
Like this :
$('#example').dataTable({
"search": {
"search" : name,
}});

Replies

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    This is from the search.search docs:

    This option can be given in the following type(s):
    string

    As you noted it needs to be a string.

    You can use the search() API inside initComplete for a dynamic search. For example:

    initComplete: function () {
      this.api().search( name ).draw();
    }
    

    Kevin

This discussion has been closed.