in code it is grid.dataprovider = youDP;
in mxml it's <mx:whatever dataprovider ="{myDP}"/>
On Mon, Jul 14, 2008 at 3:35 PM, limhy0306 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I discovered something peculiar about the behaviour of the item
> renderer for the datagrid.
>
> In my item renderer; which extends from label:
>
> public class myItemRenderer extends from Label
> {
> ......
>
> override public function set data(value:Object):void
> {
> super.data = value;
> updateStatus();
> }
> }
>
> In my DG:
> <MyDG: .... dataProvider="{myData}" ....../>
>
> When myData changes; i noticed that set data is not called.
>
> However, if I explicitly calls invalidateDisplayList() to redraw the
> regions,
>
> override protected function updateDisplayList(...):void
> {
> var list:ArrayCollection = super.data.list;
>
> ........
> }
>
> The set data was never called; but in updateDisplayList(); the
> super.data actually has the changed data!.
>
> Why is this so? Which function in this case actually sets the data?
>
> NOTE that myItemRenderer was created into the DG using a
> ClassFactory class.
> var colRendererFactory:ClassFactory = new ClassFactory
> (myItemRenderer);
>
> // dgc is a DataGridColumn
> dgc.itemRenderer = colRendererFactory;
>
> Thank you.
>
> regards,
> limhy
>
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Sid
> Maskit" <[EMAIL PROTECTED]> wrote:
> >
> > I believe that binding assignments need to use strings. Try:
> >
> > myDG.dataProvider="{ myData }"
> >
> > Hope that helps,
> >
> > Sid
> > http://CraftySpace.com
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>,
> "limhy0306" <limhy0306@> wrote:
> > >
> > > Hi,
> > >
> > > I've tried using the suggestion:
> > >
> > > myDG.dataProvider={ myData }
> > >
> > > But compilation has syntax errors: rightbrace is unexpected.
> > >
> > >
> > >
> > > Also, I've read about the binding regarding changes to the
> property
> > > for the ArrayCollection; that we need to use itemUpdated to
> inform
> > > about changes to the list.
> > >
> > > Basically the myData is a list of a class: MyClass.
> > >
> > > public class MyClass
> > > {
> > > private var _evt:ArrayCollection;
> > >
> > > .......
> > > }
> > >
> > > The var _evt changes in real-time & this changes need to be
> > > refreshed in the Datagrid.
> > >
> > > However, not all instances of MyClass stored in myData changes.
> > > In this case, I only want to redraw parts of the Datagrid that
> > > changes only.
> > >
> > > Thank you.
> > >
> > > Regards.
> > >
> > >
> > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> Simon Bailey <Nutrix@> wrote:
> > > >
> > > > myDG.dataProvider={ myData }
> > > >
> > > > On 7 Jul 2008, at 16:26, limhy0306 wrote:
> > > >
> > > > Hi,
> > > >
> > > > I've created a custom Dynamic Datagrid component. I would like
> to
> > > > ask, how can I bind data to this DG?
> > > >
> > > > My codes:
> > > >
> > > > // Data to the datagrid. This data is dynamically changing.
> > > > [Bindable]
> > > > public var myData:ArrayCollection();
> > > >
> > > > public var myDG:MyDG;
> > > >
> > > > // Called when creationComplete
> > > > private function init()
> > > > {
> > > > myDG = new MyDG();
> > > > myDG.createDataGrid(); // Create the datagrid
> > > > myDG.dataProvider = myData; //Would this bind the data?
> > > > this.addChild(myDG);
> > > > }
> > > >
> > > > I've noticed that when myData changed, myDG is not updated. In
> > > fact,
> > > > the set data() function of the ItemRenderer used in myDG is not
> > > > being called when I call myData.refresh().
> > > >
> > > > Is it the problem that I am not binding myDG correctly?
> > > >
> > > > Thank you.
> > > >
> > >
> >
>
>
>
--
j:pn
\\no comment