Perhaps you should modify the values on the model through the list’s dataProviders editField or replaceItemAt, since the changes made to the model directly won’t be reflected to the list?

You could set the list’s dataprovider once more after you modify the list directly, this might help too.

 

So something like this:

                       

<mx:List id=”myList” dataProvider="{sectionModel.region}" labelField="revenue"/>

        function processCurrentItems()
        {
            myList.dataProvider.replaceItemAt(0,13);
            myList.dataProvider.replaceItemAt(1,14);
            myList.dataProvider.replaceItemAt(2,15);
            myList.dataProvider.replaceItemAt(3,16);

        }

 

OR

 

<mx:List id=”myList” dataProvider="{sectionModel.region}" labelField="revenue"/>

        function processCurrentItems()
        {
            sectionModel.region[0].revenue = 13;
            sectionModel.region[1].revenue = 14;
            sectionModel.region[2].revenue = 15;          
            sectionModel.region[3].revenue = 16;  

            myList.dataProvider = sectionModel;

        }

 

 

-Mika

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Tariq Ahmed
Sent: 10. elokuuta 2005 7:54
To: flexcoders@yahoogroups.com
Subject: [flexcoders] An interesting problem with models....

 

A model, remoteobject, and a list walk into a bar, and the bartender ... j/k

I got a weird problem that I've narrowed down into a simple
reproduceable test case.

Got a simple model:
    <mx:Model id="sectionModel">
    <region revenue="1"/>
    <region revenue="2"/>
    <region revenue="3"/>  
    <region revenue="4"/>
    </mx:Model>  

And I got a function that just hard code updates the values:
        function processCurrentItems()
        {
            sectionModel.region[0].revenue = 13;
            sectionModel.region[1].revenue = 14;
            sectionModel.region[2].revenue = 15;          
            sectionModel.region[3].revenue = 16;  
        }

And then these two components displaying data:
<mx:List dataProvider="{sectionModel.region}" labelField="revenue"/>
<mx:Label text="{sectionModel.region[0].revenue}"/>

Now the list should show 13,14,15,16 after the above function is called,
and it does if called from the Application initialize call. But, if it's
called as a result from a remoteObject call, the model is updated, but
the List doesn't the change, however the Label does.

Attached is a working sample.

It turns out the List is updating in the remoteobject case, but the
display only updates if you move your mouse over each individual item.
Though why it works fine if the same code is executed as a result of an
initialize call is beyond me.

In the actual problem that I have - instead of a list I have a PieChart,
and its display does not update even though the model is updated (though
to complicate things the exact same code works on another machine).

Any ideas? Some caching thing?



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




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to