----- Original Message ----- 
From: "Paul Andrews" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Wednesday, October 31, 2007 3:07 AM
Subject: Re: [flexcoders] Deleting multiple line items in a datagrid


> ----- Original Message ----- 
> From: "Paul Andrews" <[EMAIL PROTECTED]>
> To: <flexcoders@yahoogroups.com>
> Sent: Wednesday, October 31, 2007 2:50 AM
> Subject: Re: [flexcoders] Deleting multiple line items in a datagrid
>
>
>>
>> ----- Original Message ----- 
>> From: "kalpkat9" <[EMAIL PROTECTED]>
>> To: <flexcoders@yahoogroups.com>
>> Sent: Wednesday, October 31, 2007 2:11 AM
>> Subject: [flexcoders] Deleting multiple line items in a datagrid
>>
>>
>>> for deleting/removing a line item for a datagrid we can use:
>>> ac.removeItemAt(dg.selectedIndex);
>>>
>>> what if we select multiple lines in the datagrid and want to delete
>>> them? could someone please let me know if there is there a command for
>>> that? thank you.
>>
>> You'll kick yourself..  ;-)
>>
>> something like:
>>
>> for (var:selectedItem:Number in dg.selectedIndices){
>>    ac.removeItem(selectedItem);
>> }
>>
>
> Better still..
>
> for (var:selectedItem:uint in
> dg.selectedIndices.sort(Array.NUMERIC|Array.DESCENDING){

Lost a bracket..   dg.selectedIndices.sort(Array.NUMERIC|Array.DESCENDING)){

>    ac.removeItem(selectedItem);
> }
>
> since the order of items is as selected by the user, not numerically
> ordered. I haven't tested this - it's either right, or pretty close. If 
> you
> don't order the array descending, you may accidentally remove the wrong
> rows, depending on the order the user selects them.
>
> Paul 

Reply via email to