Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Nov 28, 2008 03:45
open dhtmlx forum
DHX Grid: Removing whitespaces in filter #text_filter

Hi there,

How to remove the whitespaces in filter #text_filter ?
Answer posted by Support on Nov 28, 2008 05:29
I'm not pretty sure what do you mean by "remove the whitespaces", but you can use onFilterStart event as

mygrid.attachEvent("onFilterStart",function(a,b){
  //b - array of values from filter inputs
  //you may change them in any necessary way
      mygrid.filterBy(a,b);
      return false;
});
Answer posted by Tejas Shah on Nov 30, 2008 21:29
Hi there,
I mean removing extra blank spaces from start and end for filter string.

Example: "               Filter String           "

Answer posted by Support on Dec 01, 2008 02:23
mygrid.attachEvent("onFilterStart",function(a,b){
   for (var i=0; i<b.length; i++)
           b[i]=b[i].replace(/^[ ]+/,"").replace(/[ ]+$/,""); //trim whitespaces

  mygrid.filterBy(a,b);
  return false;
});