Categories | Question details Back To List | ||||||||
dhtmlxGrid Hello to all, I am trying to set up a filter on a "link" column type, but it filters by all the attributes of the cell: Link Text (including HTML), the URL and the Target. Sample data: <row id="12345"><cell><![CDATA[ <font class="thiscell">Thecorp</font>, Inc^company.asp?id=12345^_blank ]]></cell></row> Filtering by one of the following values will always return that previous row :
How can I filter only on the Link Text and omit the HTML tags in it? Thanking you in advance for whatever help you can provide me with, Steve. Answer posted by Support on Aug 12, 2008 05:06 You can use custom filter function grid.filterBy(0,function(val){ Answer posted by Steve O. on Aug 12, 2008 10:01 Hi Support, Thanks a lot for the script, much appreciated ! I'm having problems implementing it though : ... <script> function link_filter(val) { 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); 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); 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:46 Please check attached sample. Attachments (1)
|