Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Javed on Aug 29, 2008 12:38
open dhtmlx forum
dhtmlXGridFromTable Filter

Hello everyone,

I am using the dhtmlXGridFromTable to laod my data from database into the table and trid to add filter in the header using the follwing codes but it just shows the text field and the filter is not working.

myGrid.setHeader('Org Type,Org Name,Acronym,Link');
myGrid.attachHeader(',#text_search,#cspan,#cspan');

function filterBy()
        {
            var tVal = document.getElementById('title_flt').childNodes[0].value.toLowerCase();
            

            for(var i=0; i< myGrid.getRowsNum();i++)
            {
                var tStr = myGrid.cells2(i,1).getValue().toString().toLowerCase();
                var aStr = myGrid.cells2(i,2).getValue().toString().toLowerCase();
                if( tVal=='' || tStr.indexOf(tVal)==0)
                    myGrid.setRowHidden(myGrid.getRowId(i),false)
                else
                    myGrid.setRowHidden(myGrid.getRowId(i),true)
            }
        }    

would be grateful If someone can explain maybe by giving a full detail example.

thanks,
J
Answer posted on Sep 01, 2008 01:21

Most probably you havenot included next js file

ext/codebase/dhtmlxgrid_filter.js

It is neccessary to activate filters in header, if necessary file included you need just at #text_filter marker in header, and need not any custom filterBy function.
http://dhtmlx.com/docs/products/dhtmlxGrid/samples/filtering/pro_filter_srnd.html?un=1220258523000