RE: [flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID
What are you expecting this to do: datagrid2.selectedIndex.AutoB()" AutoB() is not a method of datagrid2.selectedIndex. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Nate Hardt Sent: Monday, September 04, 2006 3:09 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID Yeah if it's saying undefined method, you're going to want to make sure you are calling the right function on the right object. From the code below it looks like your DataGrid does not have an id, so try giving your datagrid an id, then call removeItemAt on the dataProvider that goes with that id. public function AutoB():void { if (myDataGrid.dataProvider.length >= 2) { myDataGrid.dataProvider.removeItemAt(0); } } dataChange="AutoB()"> On Sep 4, 2006, at 11:17 AM, tonyx_788 wrote: thanks for the help now this is what i came up with but i get this error in my datagrid component undefined method any ideas? private function AutoB():void{ if (_xlcdatagrid2.length >= 2) { this._xlcdatagrid2.removeItemAt(0); } } --- dataChange="datagrid2.selectedIndex.AutoB()" __._,_.___ -- 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 Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID
Yeah if it's saying undefined method, you're going to want to make sure you are calling the right function on the right object. From the code below it looks like your DataGrid does not have an id, so try giving your datagrid an id, then call removeItemAt on the dataProvider that goes with that id. public function AutoB():void { if (myDataGrid.dataProvider.length >= 2) { myDataGrid.dataProvider.removeItemAt(0); }}On Sep 4, 2006, at 11:17 AM, tonyx_788 wrote: thanks for the help now this is what i came up with but i get this error in my datagrid component undefined methodany ideas?private function AutoB():void{if (_xlcdatagrid2.length >= 2){this._xlcdatagrid2.removeItemAt(0);}}--- dataChange="datagrid2.selectedIndex.AutoB()" __._,_.___ -- 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 Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
[flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID
thanks for the help now this is what i came up with but i get this error in my datagrid component undefined methodany ideas?private function AutoB():void{if (_xlcdatagrid2.length >= 2){this._xlcdatagrid2.removeItemAt(0);}}--- dataChange="datagrid2.selectedIndex.AutoB()" __._,_.___ -- 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 Software development tool Software development Software development services Home design software Software development company YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID
Ahh, I see. I think what you need to do is listen for the dataChange event on the data grid you want to keep at 5 items. In the event handler, count the rows in the data provider. If it's more then 5, then do your removeItemAt(0); Here's more info on dataChange if you are unfamiliar with it: http://livedocs.macromedia.com/flex/2/langref/mx/controls/listClasses/ ListBase.html#event:dataChange On Sep 3, 2006, at 2:05 PM, tonyx_788 wrote: > --- In flexcoders@yahoogroups.com, Nate Hardt <[EMAIL PROTECTED]> wrote: >> >> Does this work? >> >> datagrid.dataProvider.removeItemAt(0); >> >> >> On Aug 29, 2006, at 4:14 PM, tonyx_788 wrote: >> >>> IS THERE ANY EXAMPLE TO DELETE THE FIRST ITEM IN A DATAGRID AFTER I >>> ADDED 5? HERE IS MY CODE TO ADD ITEMS FROM ONE DATAGRID TO ANOTHER >>> >>> import mx.collections.XMLListCollection; >>> import mx.rpc.events.ResultEvent; >>> import mx.controls.TextInput >>> import mx.controls.Alert >>> import mx.rpc.events.ResultEvent; >>> [Bindable] >>> private var _xlcdatagrid:XMLListCollection; >>> [Bindable] >>> private var _xlcdatagrid2:XMLListCollection = new XMLListCollection; >>> >>> private function onResult(oEvent:ResultEvent):void >>> { >>> _xlcdatagrid = new XMLListCollection(oEvent.result.name) >>> datagrid.dataProvider = _xlcdatagrid; >>> } >>> private function selectItem():void >>> { >>> _xlcdatagrid2.addItem(datagrid.selectedItem); >>> } >>> >>> >>> >>> >>> >>> >>> -- >>> Flexcoders Mailing List >>> FAQ: http://groups.yahoo.com/group/flexcoders/files/ >>> flexcodersFAQ.txt >>> Search Archives: http://www.mail-archive.com/flexcoders% >>> 40yahoogroups.com >>> Yahoo! Groups Links > > > that works with a button but what i want is to automatically > removeItemAt(0) when 5 items in my datagrid > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders% > 40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: AUTO DELETE ITEMS IN DATAGRID
--- In flexcoders@yahoogroups.com, Nate Hardt <[EMAIL PROTECTED]> wrote: > > Does this work? > > datagrid.dataProvider.removeItemAt(0); > > > On Aug 29, 2006, at 4:14 PM, tonyx_788 wrote: > > > IS THERE ANY EXAMPLE TO DELETE THE FIRST ITEM IN A DATAGRID AFTER I > > ADDED 5? HERE IS MY CODE TO ADD ITEMS FROM ONE DATAGRID TO ANOTHER > > > > import mx.collections.XMLListCollection; > > import mx.rpc.events.ResultEvent; > > import mx.controls.TextInput > > import mx.controls.Alert > > import mx.rpc.events.ResultEvent; > > [Bindable] > > private var _xlcdatagrid:XMLListCollection; > > [Bindable] > > private var _xlcdatagrid2:XMLListCollection = new XMLListCollection; > > > > private function onResult(oEvent:ResultEvent):void > > { > > _xlcdatagrid = new XMLListCollection(oEvent.result.name) > > datagrid.dataProvider = _xlcdatagrid; > > } > > private function selectItem():void > > { > > _xlcdatagrid2.addItem(datagrid.selectedItem); > > } > > > > > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders% > > 40yahoogroups.com > > Yahoo! Groups Links that works with a button but what i want is to automatically removeItemAt(0) when 5 items in my datagrid -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/