Categories | Question details Back To List | ||
Custom Filter in grid I have a grid where I am displaying a small icon in a column. I need to be able to filter on the image in column 4 (index 3) so have created my own select box in the grid header along with the following JS to filter the column: function statusSort(pFilterValue){ objsurveyList.filterBy(3,pFilterValue); } The only thing I can think of is perhaps the values I am using for filtering need to be escaped? Or perhaps it is matching on the text rather than the value? Guidance would be greatly appreciated. Grid XML (initialization and two rows worth of data) is as follows: <rows> <head> <beforeInit> <call command="setImagePath"> <param>/js/dhtmlxsuite/dhtmlxGrid/codebase/imgs/</param> </call> <call command="attachHeader"> <param> #master_checkbox,#select_filter,#text_filter,<div class="hdrcell filter"><select style="width: 90%; font-size: 8pt; font-family: Tahoma;" onChange="statusSort(this.value);"><option value=''></option><option value='<img src="/images/red_ball.png" height=10 width=10>'>Closed</option><option value='<img src="/images/green_ball.png" height=10 width=10>'>Open</option></select></div>,,,,,,#select_filter </param> </call> <call command="setSkin"> <param>tpmg</param> </call> </beforeInit> <column width="35" type="ch" align="center"/> <column width="175" type="ro" align="left" sort="str">Group</column> <column width="175" type="ro" align="left" sort="str">Survey</column> <column width="80" type="ro" align="center">Status</column> <column width="100" type="ro" align="left" sort="str">Due</column> <column width="80" type="ro" align="left" sort="int">Receving</column> <column width="80" type="ro" align="left" sort="int">Total Surveys</column> <column width="80" type="ro" align="left" sort="int">Done (%)</column> <column width="0" type="ro" align="left" sort="int"/> <column width="*" type="ro" align="left" sort="str">Center</column> </head> <row id="392"> <cell>0</cell> <cell>First Test Group</cell> <cell> <a href="/recipient_list.php?programme_id=392">Test ii</a> </cell> <cell> <img src="/images/green_ball.png" height=10 width=10> </cell> <cell>9 Feb 2009</cell> <cell>1</cell> <cell>1</cell> <cell>100%</cell> <cell>2009-02-09 00:00:00</cell> <cell>ELE</cell> </row> <row id="400"> <cell>0</cell> <cell>First Test Group</cell> <cell> <a href="/recipient_list.php?programme_id=400">Leadership</a> </cell> <cell> <img src="/images/red_ball.png" height=10 width=10> </cell> <cell>11 Feb 2009</cell> <cell>1</cell> <cell>0</cell> <cell>0%</cell> <cell>2009-02-11 00:00:00</cell> <cell>ELE</cell> </row> Answer posted by dhxSupport on Jul 06, 2009 06:01 You shouldn't escape values using for filtering. Grid will take "getValue()" from the cell and will search passed value in it. So if you have "<a href="/recipient_list.php?programme_id=392">Test ii</a>" in the cell, getValue() method returns string "<a href="/recipient_list.php?programme_id=392">Test ii</a>". If you need to be able to make search only by actual value (Test ii), getValue() method should return only necessary value. It can be done using custom eXcell type or by implementing custom filtering rule. Please see more information here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Combo_excell.html#grid_art_comboexcell http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Data_filtering_search.html#grid_fsing |