PDA

View Full Version : onsort event


pep
05-20-2004, 09:56 PM
I have a grid containg numbers, the positives are black and the negative are red, I load it like this:

[code]
<method name="setcolors"><![CDATA[
var txt=this.getText();
if(txt.IndexOf('-')==0)
this.setColor(0xFF0000);
else
this.setColor(0x000000);
]]>
</method>
[\code]

I first tried to call this method with ondata="this.setcolors()" , but it did not worked
(none were turned red)

I then used a trick and called this method when I show this view wich is hidden by default.

But when I sort the data in the grid, the red lines remains at the same position while the numbers move, so that none is displayed correctly.

so I am looking for a trick to do something like:

onsort="this.setcolors()"

vfunshteyn
05-25-2004, 01:52 PM
The basegridcolumn class has an attribute called hasSort. So, you could subclass it (or even gridcolumn)to use in your grid, and define a handler for the onhasSort event, which will be sent when a column is sorted upon or ceases to be.