Hi,
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
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
}
}
At which position of the code has the filter to be redefined with the sniiped code.
Before or after : mygrid.init();
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);