We're using SmartGWT 4.1 power version:
SmartClient Version: v9.1p_2014-10-03/PowerEdition Deployment (built 2014-10-03)
Our implementation has an overridden ListGrid and DynamicForm sharing the same datasource. The fields of DynamicForm are set via setFields() to preserve the grid's field presentation.
In the Grid upon SelectionUpdatedEvent we call editSelectedData(grid).
If a cell is double-clicked within that Grid row a CellDoubleClickEvent is also called, resulting in a call to a method to scroll to the corresponding item in the Dynamicform and select its value;
The problem is that the first time this is called, it appears the items are not 'drawn' yet. In the line checking for an item != null, this condition is true, however, item.isDrawn() returns null and item.getLeft() and item.getTop() both return 0.
On subsequent ListGrid cell double clicks this works fine, as the items have been drawn, and getLeft() and getTop() return valid positions. The Dynamicform scrolls to the correct field, and selects its value.
My question is how can I determine that the items in my DynamicForm have been drawn and ready to be scrolled to.. I've tried adding an ItemChangeHandler, VisibilityChangedHandler, FocusChangedHandler to the form, but none of these guarantees the items are in a state where they can be scrolled to following the form's creation. e.g. item.isDrawn() != null and getLeft()/getTop() return the fields coordinates..
SmartClient Version: v9.1p_2014-10-03/PowerEdition Deployment (built 2014-10-03)
Our implementation has an overridden ListGrid and DynamicForm sharing the same datasource. The fields of DynamicForm are set via setFields() to preserve the grid's field presentation.
In the Grid upon SelectionUpdatedEvent we call editSelectedData(grid).
If a cell is double-clicked within that Grid row a CellDoubleClickEvent is also called, resulting in a call to a method to scroll to the corresponding item in the Dynamicform and select its value;
Code:
public void focusInItem(String focusField ) { TextItem item = (TextItem)getItem(focusField); if (item != null && isVisible()) { scrollTo(item.getLeft(), item.getTop()); item.focusInItem(); item.selectValue(); } }
The problem is that the first time this is called, it appears the items are not 'drawn' yet. In the line checking for an item != null, this condition is true, however, item.isDrawn() returns null and item.getLeft() and item.getTop() both return 0.
On subsequent ListGrid cell double clicks this works fine, as the items have been drawn, and getLeft() and getTop() return valid positions. The Dynamicform scrolls to the correct field, and selects its value.
My question is how can I determine that the items in my DynamicForm have been drawn and ready to be scrolled to.. I've tried adding an ItemChangeHandler, VisibilityChangedHandler, FocusChangedHandler to the form, but none of these guarantees the items are in a state where they can be scrolled to following the form's creation. e.g. item.isDrawn() != null and getLeft()/getTop() return the fields coordinates..
Comment