Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed:
cannot convert mx.controls.dataGridClasses::DataGridItemRenderer to
mx.controls.CheckBox.)
This is the main gremlin!
On 23 Nov 2008, at 17:24, Simon Bailey wrote:
Thanks Alex,
Ok so I see where you @ in regards to recycling etc.
The problem is pinpointing exactly where to go from here, my app
wasn't necessarily straight forward and involved custom
DataGridColumns, dynamic AS creation of columns etc. I implement
aspects you demo (and from the mammoth amounts of suggestions online
from people struggling with DataGrids) to no avail, it just becomes
error city for example, suddenly Flex cannot convert my
CustomDataGridColumn, all the boxes show or the renderer chokes on
converting to CheckBox? Maybe I am getting to bogged down here and
progressively losing IQ?
Are there any bullet points here for what you suggest to prevent my
issue occurring i.e. dont determine setting the visibility of the
check box in updateDisplayList, set it here.......and ensure you
call this function...... You will also need to ensure you extend
DataGrid and implement this.....?
Cheers,
Si
On 23 Nov 2008, at 04:48, Alex Harui wrote:
Read the item renderers section on my blog (blogs.adobe.com/
aharui). Start with the oldest posting.
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Simon Bailey
Sent: Saturday, November 22, 2008 2:37 PM
To: [email protected]
Subject: [flexcoders] DataGrid itemRenderer Woes
Hi,
I have seen through google that this has been an issue but
implementing various solutions still leaves my existing problem.
Essentially I have a DataGrid with a custom itemRenderer displaying
CheckBoxes.
Within the renderer I am running a comparison on a value within the
renderers data i.e. data.my_val and the current grid row and column
values.
Depending on whether the data value equals a specific row I show or
hide the check box.
I achieve this by running the comparison logic with the overridden
updateDisplayList method below which works fine until scrolled.
override protected function updateDisplayList( unscaledWidth:Number,
unscaledHeight:Number ):void
{
super.updateDisplayList( unscaledWidth, unscaledHeight );
var row:int = listData.rowIndex+1;
for( var i:int = 0; i < data.ff.length; i++ )
{
if( data.val[listData.columnIndex-1] != undefined &&
data.val[listData.columnIndex-1].option[i] == row )
{
btn.visible = true;
}
}
}
The issue is on scroll all of the check boxes are displayed/hidden
incorrectly and the whole grid messes right up!
Any ideas pls would be appreciated.
Si