Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve O. on Aug 13, 2008 02:01
open dhtmlx forum
dhtmlxGrid custom filter implementation

Hi Support,

Thanks a lot for the previous answer, much appreciated !
I'm having problems implementing it though :

...
<script>
    function link_filter(val) {  
// custom filter function
        val = (val||"").split("^")[0].replace(/<[^>]*>/g,"");
   
        if (val.indexOf(MASK)!=-1) return true;
        return false;
    }


    var mygrid;
    function doInitGrid() {
        mygrid = new dhtmlXGridObject('mygrid_container');
        mygrid.setImagePath("lib/js/imgs/");

        mygrid.setHeader("Company,Clients");
        mygrid.attachHeader("
#text_filter,#rspan);  // attach a text filter or leave it blank ??
        mygrid.setColAlign("left,left");
        mygrid.setColSorting("
str,str");
        mygrid.setColTypes("ro,link");

I have tried :
        mygrid.filterBy(1,function(val){
            val = (val||"").split("^")[0].replace(/<[^>]*>/g,"")

            if (val.indexOf(MASK)!=-1) return true;
            return false;
        });

and I've tried this :
        mygrid.filterBy(1,link_filter);

and even this:
        mygrid.filterBy(1,link_filter());

followed by :
        mygrid.init();
        mygrid.loadXML("xml_companies.asp");
    }

</script>
...


What am I doing wrong ?

Thanks again for your time.
Steve.
Answer posted by Support on Aug 13, 2008 02:25
Please check attached sample. 
Attachments (1)