Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Gilles on Dec 24, 2009 04:02
open dhtmlx forum
Change options label of a @select_filter

Hello,

I've an img column type and I use the #select_filter on this column.
But instead of having the text of the cell (eg : /images/ico_fax.gif^Fax), I would like to have the image title.
So I use the onCollectValues event to change values of the select filter:

Xml Data :
<?xml version="1.0" encoding="UTF-8"?><rows>
<row id="1">
<cell>/images/ico_fax.gif^Fax</cell>
<cell><![CDATA[Domicile]]></cell>
<cell><![CDATA[0678451245]]></cell>
</row>
<row id="3">
<cell>/images/ico_portable.gif^Portable</cell>
<cell><![CDATA[Bureau]]></cell>
<cell><![CDATA[4657812349]]></cell>
</row>
</rows>

oGrid.attachEvent("onCollectValues", function(index){
if (index == 0) {
values = oGrid.collectValues(0);
for(i=0 ; i<values.length ; i++) {
values[i] = values[i].substr(values[i].lastIndexOf('^')+1);
}
return values;
}
else {
return true; //default processing
}
});

But the select is empty.
Could you help me please ?
Answer posted by dhxSupport on Dec 28, 2009 02:26
collectValues() method can return array of column value only if all rows from the column is rendered. In you case "onCollectValue" method is called too early when no rows are loaded yet. 
In you case better to change "img" cell so getValue() method will return necessary value. Please find more information about custom eXcell creation here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:toc_custom_excell_creation
Answer posted on Dec 28, 2009 05:28
Thank you for your answer.

I've created a new excell type and I change the column type to 'ico'.
But is the select filter, there is the <img> tag instead of the real value  specified if the setCvalue function.

Another problem is that the title attribute is cleared. Why ?
Attachments (1)