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/
 


Reply via email to