Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ihor H on Mar 19, 2009 07:37
open dhtmlx forum
Grid custom column with text filter

Hi

When I insert new column into grid by mygrid.insertColumn, is this possible to add #text_filter for that newly created column using mygrid.attachHeader or some other method?

Thanks
Answer posted by dhxSupport on Mar 19, 2009 10:18

Unfortunately its impossible to insert #text_filter into the recently added column. By you can insert custom input and implement custom search with filterBy() method:

function insertColumn(){
  index=0;
  mygrid.insertColumn(index,"New Column","ed",150,"str");
  mygrid.hdr.rows[2].cells[index].innerHTML="<input id='filter' onkeypress='customFilter(index)' />"
  mygrid.hdr.rows[2].onclick=function(e){ (e||event).cancelBubble=true; }
 }
 function customFilter(index){
 var val=document.getElementById("filter").value;
  mygrid.filterBy(index,val);
 return true;
 }