Hi,
I tried to implement a filter, which searchs onkeyup in 2 columns. If I load the grid with a xml file, it works fine. But i if I load my Values from a database with the .net Connector, the filter doesen’t work. Nothing happens. Do you have any ideas why?
Javascript:
<script type="text/javascript">
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath('codebase/imgs/');
mygrid.setHeader("Firstname, Lastname, Status");
mygrid.setInitWidths("100,*")
mygrid.setColTypes("ed,ed,co");
mygrid.setColSorting("connector,connector")
mygrid.enableSmartRendering(true)
mygrid.enableMultiselect(true)
mygrid.init();
mygrid.loadXML("baseGridConnector.ashx?dynamic=50");
var dp = new dataProcessor("baseGridConnector.ashx?dynamic=50");
dp.init(mygrid);
//mygrid.loadXML("grid.xml");
function filt() {
var val = document.getElementById("match").value;
mygrid.filterBy(0, function (value, id) {
if (mygrid.cells(id, 0).getValue().toLowerCase().indexOf(val) != -1) return true;
if (mygrid.cells(id, 1).getValue().toLowerCase().indexOf(val) != -1) return true;
return false;
});
}
</script>
HTML Output
Filter<div><input id="match" size="20" onclick="(arguments[0]||window.event).cancelBubble=true;" onkeyup="filt()" /></div>
<div id="gridbox" style="background-color:white;overflow:hidden;width:550px;height:450px"></div>