Flex wouldn't let me. I did an inline renderer:
<datagrid....
<datacolumn blah blah blah...
<component...
<itemrenderer>
<checkbox change="processmychange()"...
</checkbox>
</itemrenderer>
</component>
</datacolumn>
</datagrid>
Flex said it couldn't find processmychange(). However, when I put the
change="processmychange()" inside the datagrid declaration, it found
it okay.
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]>
wrote:
>
> If you hang it on the DG, then any click in the row whether on the
> checkbox or not will send a change (of selectedIndex)
>
> If you hang it on the checkbox, then a change to the selected state
of
> the checkbox will trigger your code.
>
>
>
> How are you trying to get the change handler on the checkbox?
>
>
>
>
>
> ________________________________
>
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of phdcpe01
> Sent: Monday, August 06, 2007 2:22 PM
> To: [email protected]
> Subject: [flexcomponents] Re: Datagrid Update
>
>
>
> Just to be clear, should I be monitoring a change on the datagrid,
or
> the checkbox? If it's supposed to be on the checkbox, I'm in
trouble
> because it's not letting me put in a change="processmyChange"
handler
> on it.
> --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <aharui@>
> wrote:
> >
> > OK, it looks like you're relying on the state of
> editedItemRenderer. In
> > that case, you might want to set rendererIsEditor=true and
> > editable=true, but still react to the change handler instead of
> > itemEditEnd
> >
> >
> >
> >
> >
> >
> >
> > ________________________________
> >
> > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of phdcpe01
> > Sent: Monday, August 06, 2007 11:25 AM
> > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > Subject: [flexcomponents] Re: Datagrid Update
> >
> >
> >
> > I believe this may work, but it introduces two more problems:
> > 1. Without renderiseditor, my checkbox turns into a text field
when
> > the user selects it, as opposed to simply remaining a checkbox.
> > 2. Since I'm monitoring it on the change, instead of the end of
the
> > change, my logic for testing whether I should add the row to the
> > arraycollection will be confused. Before, I would check to see if
> the
> > checkbox.selected = true (meaning they added it), and I would.
Now,
> > according to the debugging sessions, checkbox.selected = false
all
> > the time. How do I get around these problems?
> >
> > --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui"
<aharui@>
> > wrote:
> > >
> > > Turn off rendererIsEditor and use "change" instead of
itemEditEnd.
> > >
> > >
> > >
> > > Editors are session based and don't "execute" until you move
> focus
> > from
> > > the cell.
> > >
> > >
> > >
> > > ________________________________
> > >
> > > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of phdcpe01
> > > Sent: Monday, August 06, 2007 6:22 AM
> > > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > Subject: [flexcomponents] Re: Datagrid Update
> > >
> > >
> > >
> > > DG1: Has a checkbox as the item renderer, with itemaseditor set
> to
> > > true.
> > > itemEditEnd is set to call a function, passing in the event.
The
> > > listener has this code:
> > > public function processmyGrid1(event:DataGridEvent):void {
> > > trace("ended event");
> > > if(event.dataField=="selected"){
> > > if(mx.controls.CheckBox(myGrid1.editedItemRenderer).selected)
> > > myArrayList.addItem(myGrid1.editedItemRenderer.data);
> > > else
> > > trace(myArrayList.getItemIndex
> > > (myGrid1.editedItemRenderer.data).toString());
> > >
> > > }
> > >
> > > //myArrayList.itemUpdated(myGrid1.editedItemRenderer.data);
> > > //myArrayList.refresh();
> > > //myGrid2.validateNow();
> > > //myGrid2.invalidateDisplayList();
> > > //myGrid2.invalidateList();
> > > //myPanel.validateDisplayList();
> > > myPanel.invalidateDisplayList();
> > >
> > > Elsewhere, I have code along the lines of:
> > > myGrid2.dataprovider = myArrayList;
> > >
> > > When the above code executes, the object is added to myGrid2,
but
> > > it's not reflected in it until I click. All the commented out
> > > statements are things I've tried, that still don't work.
myPanel
> is
> > > the panel that holds myGrid2.
> > >
> > > --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui"
> <aharui@>
> > > wrote:
> > > >
> > > > How are you adding the row to the second DG's array
collection?
> > > >
> > > > What does your renderer code look like?
> > > >
> > > >
> > > >
> > > > ________________________________
> > > >
> > > > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of
phdcpe01
> > > > Sent: Saturday, August 04, 2007 7:43 PM
> > > > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > Subject: [flexcomponents] Re: Datagrid Update
> > > >
> > > >
> > > >
> > > > That still didn't do the trick...
> > > > --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui"
> > <aharui@>
> > > > wrote:
> > > > >
> > > > > I think you want itemUpdated()
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > >
> > > > > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of
> phdcpe01
> > > > > Sent: Saturday, August 04, 2007 7:03 PM
> > > > > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > Subject: [flexcomponents] Re: Datagrid Update
> > > > >
> > > > >
> > > > >
> > > > > I do call arraycollection.refresh() afterwards. However,
the
> DG
> > > > only
> > > > > updates when you click the panel that contains it, instead
of
> > > > > immediately.
> > > > > --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > <mailto:flexcomponents%40yahoogroups.com> , "Tracy Spratt"
> > > > <tspratt@>
> > > > >
> > > > > wrote:
> > > > > >
> > > > > > Are you using the ArrayCollection API to update it? This
> > should
> > > > > cause
> > > > > > the DG to update automatically.
> > > > > >
> > > > > > Tracy
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of
> > phdcpe01
> > > > > > Sent: Saturday, August 04, 2007 2:36 PM
> > > > > > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com>
> > <mailto:flexcomponents%40yahoogroups.com>
> > > <mailto:flexcomponents%40yahoogroups.com>
> > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > <mailto:flexcomponents%40yahoogroups.com>
> > > > > > Subject: [flexcomponents] Datagrid Update
> > > > > >
> > > > > > Hello,
> > > > > > I've got two datagrids, myGrid1 and myGrid2. Basically,
the
> > > user
> > > > > can
> > > > > > select a row in myGrid1, and it'll show up in myGrid2. I
am
> > > using
> > > > > an
> > > > > > arraycollection as the dataprovider for myGrid2.
Selecting
> > the
> > > > > checkbox
> > > > > > in myGrid1 properly adds the corresponding row to the
> > > > > arraycollection.
> > > > > > However, this isn't reflected in myGrid2 unless you click
> on
> > > it,
> > > > or
> > > > > > some other window moves in front of it. How can I make
> > myGrid2
> > > > > update
> > > > > > each time there's a change to the arraycollection?
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > >
> > > >
> > >
> >
>