--- In flexcoders@yahoogroups.com, "polestar11" <[EMAIL PROTECTED]> 
wrote:
>
> Hi there
> 
> I have an ArrayCollection value in my model class, which I would 
like
> to run through a formatter function in my view. This method works 
with
> a string, but performs strangely for a collection, where:
> 1) The format function is never called on update
> 2) The bound control reflects the update if I return the
> ArrayCollection reference from the function, and doesn't reflect the
> update if I return a reference to a different object (even though 
the
> function is never called)
> 
> 
> View:
> -------------------- snip ---------------------------
> // formatting function 
>               public function formatTree(data:ArrayCollection) {
>                       data.addItem(new MoveVO());
>                       return data;
>               }
> -------------------- /snip ---------------------------
> -------------------- snip ---------------------------
> // tree control
> <mx:Tree id="moveTree" x="203" y="2"
> dataProvider="{formatTree(model.currentMoves)}" labelField="text"
> height="190" width="193"></mx:Tree>
>       
> 
> -------------------- /snip ---------------------------
> 
> I have also tried using a <mx:Binding> tag to perform the operation,
> as well as Paul Williams 'smallest tag'*, both of which do not 
reflect
> an update to the ArrayCollection value. Trying to follow up on this 
in
> the documentation I found the following, which seems to imply that 
the
> formatting function should work:
> 
> "You can use ActionScript functions as the source of binding
> expressions. You usually do this when using a bindable property as 
an
> argument of a function. When the bindable property changes, the
> function executes, and the result is used in the binding 
destination ..."
> 
> Regards
> Tracy
> 
> 
*http://weblogs.macromedia.com/paulw/archives/2006/05/the_worlds_smal.
cfm
>
I'm having what might be a related problem, calling a formatter 
within a labelfunction applied to an editable dataGrid column. Here 
is the code:

public function display(datum:Object,column:DataGridColumn):String{
                        
                        if(datum.name=="Name2"){                
                                return Dollars.format(datum.value);
                        
                        }
                        else{
                                return String(datum.value)+"%";
                                
                        }
                }

And the formatter...

<mx:CurrencyFormatter id="Dollars" precision="0"
        rounding="none"
        decimalSeparatorTo="."
        thousandsSeparatorTo=","
        useThousandsSeparator="true"
        useNegativeSign="true"
        currencySymbol="$"
        alignSymbol="left"/>

The home-brewed % format thing works fine; the formatter fn doesn't 
and is unprdictable, wanting to be zero, forgetting the entry, etc. 
Any ideas welcome.






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to