Hi, just looking for advice on the most appropriate way to approach this (or
links to existing examples) :)

I've got a DataGrid, and the items use a subclass of NumericStepper. This
stepper validates itself depending on the total of *all *items in that
column  (i.e. it styles itself green if the column-total adds up to, say,
100, or red if the column-total is <> 100). In other words, a single
itemRenderer needs knowledge of the values of ALL renderers in that column.

I'm aware that itemRenderers should only take care of setting themselves,
due to recycling -  (ie Adobe don't intend developers to get hold of a list
of all renderers, cycle over them and set properties on them externally).

In this case however, in order to validate a *single *renderer I need to
know about the total of all renderers within a single column. Currently I
have things working - I give each renderer knowledge of its owner's
dataProvider - then, in the renderer's validation method I loop through all
items in the dp, total them up and set the style accordingly.

However, this feels wrong. Also, it's not so bad if I have a
PercentageStepper, where I could hardcode the total as 100, but what about
columns where the user has a set amount of cash, and the total of all
Steppers must equal that cash-value? In that case, using my setup,
*each *renderer
also needs to know the total cash amount, which means setting it on each
renderer (easy to do, but again it feels wrong).

So in a nutshell I guess I'm saying, what's the preferred way of validating
an itemRenderer, when the validation of that renderer depends on properties
of all the itemRenderers in that column?

Thanks

Reply via email to