I have a drag and drop target datagrid. I need to count how many items are in this grid every time something is dropped.
I am using dragDrop event to trigger a handler that gets the length of the datagrid's data provider.
However, when the first item is dropped, the dataprovider is null.
When the second item is dropped the dataprovider.length is 1; although there are 2 items.
And each subsequent one the length is one less than it should be.
Why is this? If it is not updating properly is there a different event I should bind to?
In the dragAndDrop handler try using a the callLater method to call the row count handler.
That way the dragNDrop can complete before the count takes place.
You can also try the dragComplete handler. This is typically where any cleanup is done.
callLater is Golden. Thanks!