Dhtmlxgrid Filtering clarification

I have 10 columns in the grid and i would like to filter grid data with single text box that should check all the column in the grid. makeFilter(id,column,preserve) wont be helpful as it would point to single column, in my requirement i want to point to all column with the single text box. is this feature come out of box or is it achievable in Dhtmlxgrid. i explored but it couldnt help. Please let me know. Thank you


Bad news: You need to redefine the logic of the default filter.Here you can find a tutorial:
docs.dhtmlx.com/doku.php?id=dhtm … of_filters

Good news: the example in the tutorial shows the logic you require, so you may just use the code from the tutorial:

mygrid.getFilterElement(0)._filter = function(){
    var input = this.value; // gets the text of the filter input
    return function(value, id){
         for(var i=0;i<mygrid.getColumnsNum();i++){ // iterating through the columns
             var val=mygrid.cells(id,i).getValue() // gets the value of the current cell
             if (val.toLowerCase().indexOf(input.toLowerCase())!==-1){ // checks if the value of a cell have the text from the filter 
                 return true
         return false

i got the same issue. I got 2 questions.

  1. At which position of the code has the filter to be redefined with the sniiped code.
    Before or after : mygrid.init();

  2. What should the method look like to invoke the filter with a single text box?
    The method “makeFilter” need the ID of the inputfiled and a column-ID.
    Example: mygrid.makeFilter(“textFilter”, 2);


Here is a working example:

1 Like

Perfect! Thanks for this quick support!