Ok, my apologies for the irritating vagueness in my explanation:

What I am trying to do is populate 2 grids using an array of value objects. Each grid uses various properties of the said value objects, some different and some the same. I have a custom render which extends checkbox and thus displays checkboxes throughout the grids.
I simply want to be able to select ONE checkbox in each grid.
If a check box in one grid is selected and its row is different to the currently selected check box in the second grid, I will be aiming to then:

1) Deselect the check box in the second grid.
2) Highlight the row in the second grid to match the newly selected row in the first grid.

For this to happen I have followed the typical route i.e. have as much of the handling of the check box selections within the renderer itself and driven from the data property e.g.

override public function set data(value:Object):void
{
                if( value != null )
                {
                        super.data = value;

                        selected = ( data.column == listData.columnIndex &&
data.row == listData.rowIndex ) ? data.selected : false;
                }
}

override protected function clickHandler(event:MouseEvent):void
{
        super.clickHandler(event);
        
        data.selected    = selected;
        data.row             = listData.rowIndex;
        data.column      = listData.columnIndex;
        
        ( listData.owner as CustomGrid ).invalidateList();
        IList(DataGrid(owner).dataProvider).itemUpdated(data);
}

btw duplicating an Array using concat() did not work unfortunately as (adobe doc quote) 'changes are still made to both arrays. So I used (adobe docs):

private function clone( source:Object ):*
{
            var myBA:ByteArray = new ByteArray();
        
            myBA.writeObject( source );
            myBA.position = 0;
                
            return( myBA.readObject() );
}

On 29 Dec 2008, at 20:25, Tracy Spratt wrote:


We need a little more functional description than, “a custom renderer and all that jazz”. Exactly what are you trying to show/do?

Tracy



From: [email protected] [mailto:[email protected]] On Behalf Of Simon Bailey
Sent: Monday, December 29, 2008 3:01 PM
To: [email protected]
Subject: Re: [flexcoders] Re: 2 Datagrid issue



Ok I am a numbnut! Rsolved through 2 seperate arrays, into two seperate arraycollections!



I must add that if the 2 Array sources are different I then result in the issue of multiple selections (CheckBox) on row and in column. Are there any suggestions on how to overcome this?



On 29 Dec 2008, at 19:24, Tim Hoff wrote:





Are the 2 ArrayCollections using the same source array by any chance?

-TH

--- In [email protected], "Tracy Spratt" <tspr...@...> wrote:
>
> Probably, but we'll need to see a bit of the relevant code. Start with
> the DataGrid declaration mxml and the change handler function.
>
>
>
> Tracy
>
>
>
> ________________________________
>
> From: [email protected] [mailto:[email protected]]
On
> Behalf Of Simon Bailey
> Sent: Monday, December 29, 2008 1:37 PM
> To: [email protected]
> Subject: [flexcoders] 2 Datagrid issue
>
>
>
> Hi,
>
> I have 2 DataGrids working with a custom renderer and all that jazz
> but 2 seperate ArrayCollections as data provider. On select of an
> item in one grid I set the data['selected'] property accordingly and
> call an itemUpdated in the ArrayCollection. Can anyone think why a
> selection in one grid is also selecting an item in the second grid?
>







Reply via email to