You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by scott matheson <sc...@matheson.it> on 2017/03/25 19:05:23 UTC

Selecting all items on a dataGroup

Hi
    i want to selecta ll the items in a dataGrid, i was trying to populate the selectedItems,  any ideas 

thanks 



private function selectAll():void{

    dg.selectedItems = null;

   var _user;
   for each( _user in this._listofUser){
        dg.selectedItems.push(_user);
   }

}



<s:DataGrid id="dg"  width="300" height="500" dataProvider="{this._listofUser}"
         selectionMode="multipleRows"

   <s:columns>
      <s:ArrayCollection>

         <s:GridColumn headerText="First" dataField="firstName" minWidth="50"  />
         <s:GridColumn headerText="Surname" dataField="surname"  minWidth="70"  />


      </s:ArrayCollection>
   </s:columns>


</s:DataGrid>



Re: Selecting all items on a dataGroup

Posted by scott matheson <sc...@matheson.it>.
thanks that’s working 


> On 26 Mar 2017, at 09:47, Hans Nuecke <hn...@vservu.de> wrote:
> 
> I use something like this:
> 
>            var allIndices:Vector.<int> = new Vector.<int>();
>            var i:int;
>                for (i = 0; i < finalSelection.length; i++) {
>                    allIndices.push(i);
>                }
>            dgMyElements.selectedIndices = allIndices;    // your  <s:DataGrid id="dgMyElements"/>
> 
> Hans
> 
> 
> Am 25.03.2017 um 20:05 schrieb scott matheson:
>> Hi
>>     i want to selecta ll the items in a dataGrid, i was trying to populate the selectedItems,  any ideas
>> 
>> thanks
>> 
>> 
>> 
>> private function selectAll():void{
>> 
>>     dg.selectedItems = null;
>> 
>>    var _user;
>>    for each( _user in this._listofUser){
>>         dg.selectedItems.push(_user);
>>    }
>> 
>> }
>> 
>> 
>> 
>> <s:DataGrid id="dg"  width="300" height="500" dataProvider="{this._listofUser}"
>>          selectionMode="multipleRows"
>> 
>>    <s:columns>
>>       <s:ArrayCollection>
>> 
>>          <s:GridColumn headerText="First" dataField="firstName" minWidth="50"  />
>>          <s:GridColumn headerText="Surname" dataField="surname"  minWidth="70"  />
>> 
>> 
>>       </s:ArrayCollection>
>>    </s:columns>
>> 
>> 
>> </s:DataGrid>
>> 
>> 
>> 
> 
> -


Re: Selecting all items on a dataGroup

Posted by Hans Nuecke <hn...@vservu.de>.
I use something like this:

             var allIndices:Vector.<int> = new Vector.<int>();
             var i:int;
                 for (i = 0; i < finalSelection.length; i++) {
                     allIndices.push(i);
                 }
             dgMyElements.selectedIndices = allIndices;    // your  
<s:DataGrid id="dgMyElements"/>

Hans


Am 25.03.2017 um 20:05 schrieb scott matheson:
> Hi
>      i want to selecta ll the items in a dataGrid, i was trying to populate the selectedItems,  any ideas
>
> thanks
>
>
>
> private function selectAll():void{
>
>      dg.selectedItems = null;
>
>     var _user;
>     for each( _user in this._listofUser){
>          dg.selectedItems.push(_user);
>     }
>
> }
>
>
>
> <s:DataGrid id="dg"  width="300" height="500" dataProvider="{this._listofUser}"
>           selectionMode="multipleRows"
>
>     <s:columns>
>        <s:ArrayCollection>
>
>           <s:GridColumn headerText="First" dataField="firstName" minWidth="50"  />
>           <s:GridColumn headerText="Surname" dataField="surname"  minWidth="70"  />
>
>
>        </s:ArrayCollection>
>     </s:columns>
>
>
> </s:DataGrid>
>
>
>

-