Spark DataGrid Binding Problem
Hi all ,
I'm working on Flex Hero (build 18623)
I have a Spark DataGrid and a Button which delete the selected item on the DataGrid.
Obviously we would like the Button to be enabled only when there is a selection on the DataGrid so we binded the enable property of the Button to the selectedIndex of the DataGrid (Alternately we can use the selectedItem).
When the application starts the Button – as expected – is disabled .
Once we select any raw/item on the DataGrid the Button – as expected – becomes enabaled.
When we press the button the selected item on the DataGrid is deleted - also as expected.
THE PROBLEM – after the deletion is completed although we find that the DataGrid selectedItem and selectedIndex are null and -1 respectively which indicates that there is no selection on the DataGrid and it's good …
BUT the Button – from some reason is still enabled.
It seemed like binding is not working good from the DataGrid to the Button.
ANOTHER THING :
Check out the variable dg_selectedItemin the code below, which has Two Way Binding with the DataGrid selectedItem property. Also this variable isn't being updated after the deletion is completed – although the DataGrid selectedItem property is null – the above mentioned variable is still holding the item/Object who was just deleted from the DataGrid.
I Also tried this on Flex Hero build 17689 and it's not working as well.
IMPORTANT : I also checked all the above using the mx:AdvancedDataGrid instead s:DataGrid and it's working good – the Button becomes disabled after the deletion.
So it seems to be a bug in the spark data grid.
Anyone has an idea how to solve this problem?
Thanks,
Shamir
Here is the code.
