Thank you, Karl!! you've pointed me to the right direction. Turns out I was
doing 2 thins wrong.
first off, even though the "MyDataList" was marked as [Bindable] *inside* my
component, it also wanted the [Bindable] tag when i actually defined a
reference to the component! ([Bindable] public var
mycomponent:MyComponentClassName)
second, i initially avoided curly brackets because i thought flex will have
problem with the variable being null (it gets initialized later on). turns
out flex doesn't care!! it updates stuff when the data actually appears. so
i'm all good!
Thank you!!!
P.S. as a side note, i really gotta go through the whole flex2 developer's
guide... this was on page like 10xx of 1200, so... thanks guys!
On 2/22/07, Karl Johnson <[EMAIL PROTECTED]> wrote:
Unless you have something that is preventing you from actually binding
in mxml, you should just add dataProvider="{mycomponent.MyDataList}" as a
property in the mx:List component. If you want to setup the bind in
actionscript, you can use BindingUtils.bindProperty.
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001043.html
Karl
Cynergy
------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Andrey
*Sent:* Thursday, February 22, 2007 8:55 PM
*To:* [email protected]
*Subject:* Re: [flexcoders] dataProvider question
Sure!
my list is defined as follows:
<mx:List id="lstData" width="100%" height="100%"
labelField="@name" ></mx:List>
In my component (well, class) i have the following variable:
[Bindable]
public var MyDataList:XMLList = new XMLList();
then when the application loads and i get the instance of the component, i
call the following:
lstData.dataProvider = mycomponent.MyDataList;
everything looks ok so far, right? then then when i receive a proper xml,
i update it all inside the component:
MyDataList = new XML(myxmlstring).children();
theoretically the lstData should somehow receive notification that the
dataProvider has been updated and refresh itself, right? this doesn't seem
to work. Since this doesn't seem to work we're reserved to throwing events
from the component to the list and rebinding the list when that event is
caught by the gui, but the whole thing is pretty cumbersome and i think this
should work automatically.... what are we doing wrong?
Thank you!
On 2/22/07, Igor Costa <[EMAIL PROTECTED]> wrote:
>
> It would be nice to see your part of you code to see what you are
> doing wrong.
>
>
> Regards.
>
> On 2/22/07, darvon4u < [EMAIL PROTECTED]> wrote:
> >
> > Here is an interesting one, not sure if i'm missing something or
> > what.
> >
> > I have a list to show some data.
> >
> > I also have a component with an xmllist property which is marked as
> > [Bindable]
> >
> > in actionscript, i instantiate that component and bind this data
> > property to the list.
> >
> > When i receive data from webservice, i update the xmllist of the
> > component. shouldn't the visual list update as well since it is bound
> > to that component's property?
> >
> > also, i have tried this with an XMLListCollection as well and same
> > result. only if i rebind the list to the component's property do i get
> > the result.
> >
> > what i am doing wrong? is this by design? should there be something
> > else wired or triggered for the updates to occur automatically?
> >
> > thank you in advance if anybody can help in any way,
> >
> > -A
> >
> >
>
>
> --
> ----------------------------
> Igor Costa
> www.igorcosta.org
> www.igorcosta.com
> skype: igorpcosta
>
>