Again, not sure how this would work in Flash, but in Flex you would
have a cell renderer for the button.
Inside the cell renderer you have a setValue() method that allows you
to determine something about the data for that row, so you can disable
the button or whatever else you need to do.
You also have a reference to the list itself through the listOwner
property, so when you get a click event on the button you can call
listOwner.dispatchEvent() and dispatch a custom event from the list.
Since you're creating the event you can easily put the data that
applies to that row in there. In the event handler for your custom
event you can loop over the dataProvider for the list and check which
row matches the data in the event. That will give you the row index.
There are lots of other ways to do it, but that's about the most
generic, so it should work for most scenarios.
Hopefully that makes some sort of sense.
Spike
On 3/10/06, Rodrigo Guerra <[EMAIL PROTECTED]> wrote:
> thanks spike, clint for the help.
>
> the dataProvider removeItemAt method works like a charm.
>
> i added the code below to get the grid row, but it's not working:
>
> var myListener = new Object();
> myListener.cellFocusIn = function(eventObject) {
> var cell = eventObject.itemIndex ;
> trace("The cell row is " + cell + " has gained focus");
> };
> myGrid.addEventListener("cellFocusIn", myListener);
>
> but it ONLY works if i have the property "dg.editable" set to true, and this
> property can't be true at this time.
> how can i get the dg row?
>
> regards,
> rodrigo
>
> ----- Original Message -----
> From: "Spike" <[EMAIL PROTECTED]>
> To: "Flashcoders mailing list" <[email protected]>
> Sent: Friday, March 10, 2006 4:01 PM
> Subject: Re: [Flashcoders] datagrid icon to delete a row.
>
>
> Not sure if this applies to the datagrid component in Flash, but to to
> this in Flex 1.5 you would do:
>
> myDataGrid.dataProvider.removeItemAt(someIndex);
>
> Spike
>
> On 3/10/06, Rodrigo Guerra <[EMAIL PROTECTED]> wrote:
> > my grid dataprovider is a xml (created in flash).
> >
> > the only way i can think to refresh the datagrid is associate it (again)
> to
> > the xml source (updated). like delete the node then myDG.dataProvider =
> > myXml (updated)....
> >
> > is this correct?
> >
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Clint Tredway" <[EMAIL PROTECTED]>
> > To: "Flashcoders mailing list" <[email protected]>
> > Sent: Friday, March 10, 2006 2:19 PM
> > Subject: RE: [Flashcoders] datagrid icon to delete a row.
> >
> >
> > Basically what you will need to do is get the id of that row and remove
> > it from the data populating the grid and then refresh the grid. (If I
> > remember correctly) ;)
> >
> > HTH
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Rodrigo
> > Guerra
> > Sent: Friday, March 10, 2006 11:07 AM
> > To: Flashcoders mailing list
> > Subject: [Flashcoders] datagrid icon to delete a row.
> >
> > hi all,
> >
> > i'm using this example from phil,
> > http://philflash.inway.fr/dgrenderer/dgiconrd.html to put a image inside
> > a datagrid colum. (any other you can share would be appreciated)
> >
> > what i want is click in the image and delete the row. i thought the
> > datagrid class would provide a easy method like "removeRow(index)".. but
> > there isn't.
> > what's the code to delete a row in the datagrid.
> >
> >
> > thanks!
> >
> >
> >
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
>
>
> --
> --------------------------------------------
> Stephen Milligan
> Do you do the Badger?
> http://www.yellowbadger.com
>
> Do you cfeclipse? http://www.cfeclipse.org
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
--
--------------------------------------------
Stephen Milligan
Do you do the Badger?
http://www.yellowbadger.com
Do you cfeclipse? http://www.cfeclipse.org
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com