Expansion Component disappears from list grid when the expanded record is updated from a different view. The grid when queried on the expansion state of the record, states it is expanded yet the icon shows that it is not expanded and the component is missing.
By attaching a data changed handler to the result set, I can see the updates when they come in. Calling grid.isExpanded at this time on the record returns true. Expanding the record at this time does not affect the end result.
Waiting 5 seconds and the grid.isExpanded still returns true.
It appears that the expansion canvas is getting lost in the redraw and the state of the grid no longer matches the actual view. Even collapseRecord followed by expandRecord fails to restore the expansion.
My preference is to just have control via an api similar to setReselectOnUpdate and setReselectOnUpdateNotifications
setReexpandOnUpdate and setReexpandOnUpdateBehavior
createNew -- call getExpansionComponent and replace the component without events
expand -- call getExpansionComponent and replace the component and send the expand event
collapse_expand -- call collapseRecord and expandRecord with events.
useOld -- recycle the exsisting component without updates or events.
1. SmartClient Version: v9.1p_2014-09-24/PowerEdition Deployment (built 2014-09-24)
2. FF 30.0
6.
By attaching a data changed handler to the result set, I can see the updates when they come in. Calling grid.isExpanded at this time on the record returns true. Expanding the record at this time does not affect the end result.
Waiting 5 seconds and the grid.isExpanded still returns true.
It appears that the expansion canvas is getting lost in the redraw and the state of the grid no longer matches the actual view. Even collapseRecord followed by expandRecord fails to restore the expansion.
My preference is to just have control via an api similar to setReselectOnUpdate and setReselectOnUpdateNotifications
setReexpandOnUpdate and setReexpandOnUpdateBehavior
createNew -- call getExpansionComponent and replace the component without events
expand -- call getExpansionComponent and replace the component and send the expand event
collapse_expand -- call collapseRecord and expandRecord with events.
useOld -- recycle the exsisting component without updates or events.
1. SmartClient Version: v9.1p_2014-09-24/PowerEdition Deployment (built 2014-09-24)
2. FF 30.0
6.
Code:
@Override protected Canvas getExpansionComponent(ListGridRecord listGridRecord) { CustomView view = new CustomView(); view.setData(listGridRecord); view.setMode(FormMode.VIEW); addListenerToForm(view); return view; } grid.addRecordExpandHandler(new RecordExpandHandler() { @Override public void onRecordExpand(RecordExpandEvent recordExpandEvent) { Integer id = recordExpandEvent.getRecord().getAttributeAsInt("id")); if(id != null) { expandedRecordId = id; GWT.log("record expanded"); } } }); changes.addDataChangedHandler(new DataChangedHandler() { @Override public void onDataChanged(DataChangedEvent dataChangedEvent) { GWT.log("data changed"); if(expandedRecordId != null) { final int index = grid.findIndex(new AdvancedCriteria("id", OperatorId.EQUALS, expandedRecordId)); final ListGridRecord record = grid.getRecord(index); boolean expanded = grid.isExpanded(record); grid.expandRecord(record); GWT.log("oldId: "+expandedRecordId+" wasExpanded: " + expanded+" index: " + index+ " rec.id: " + record.getAttribute("id")+ " isExpanded: "+grid.isExpanded(record)); Timer time = new Timer() { @Override public void run() { GWT.log("OldId: "+expandedRecordId+" index: " + index + " rec.id: " + record.getAttribute("id")+ " isExpanded: "+grid.isExpanded(record)); } }; time.schedule(5000); } } }); changes.getRange(0, 75);
Code:
"oldId: 4 wasExpanded: true index: 0 rec.id: 4 isExpanded: true" 5 seconds later... "OldId: 4 index: 0 rec.id: 4 isExpanded: true"
Comment