Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sieglj on Mar 02, 2009 10:41
open dhtmlx forum
grid filtering

I want to add simple text filters to my columns: I saw several methods and responses in docs and knowlege base for grid filtering. I've tried several methods and have run into errors each way:



1.

    <input type="text" id="textobject">
    <script>
.....
        mygrid.makeFilter("textobject",0);
mygrid.loadXML("/static/data/step3.xml")

</script>

I get an object does not support this method error on the makeFilter line.

2.
borrowed from the samples section:
mygrid.attachHeader("#rspan,<div id='title_flt'></div>,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan,#rspan");
document.getElementById("title_flt").appendChild(document.getElementById("title_flt_box").childNodes[0])
mygrid.setSizes();
mygrid.loadXML("/static/data/step3.xml")






function customFilter(){
columnIndex=1;
var tVal = document.getElementById("title_flt").childNodes[0].value.toLowerCase();
//alert(tVal)
mygrid.filterBy(columnIndex,tVal);
}


....
<body onload="doInitGrid()">
<div id="title_flt_box"><input type="100%" style="border:1px solid gray;" onclick="(arguments[0]||window.event).cancelBubble=true;" onkeyup="customFilter()"></div>
<div id="mygrid_container" style="width:1000px;height:150px;"></div>




I get an "object does not support this method" on the mygrid.filterBy() in customFilter().

I would prefer filters built into the header (#2 example) as with the combo header example in your samples, but would like to get any method to work to start!

Thanks!
Answer posted by dhxSupport on Mar 03, 2009 01:29
To use this methods you have to include dhtmlx_filter.js file