I have a question with regards to SmartGWT ListGrid.
The following use case explains,
There is one ComboBoxItem which has few records loaded in them. There is ListGrid just beneath the ComboBoxItem.
ComboItem has ChangeEvent (not Changed) Handler which captures user changes. Also this change triggers fetchData on ListGrid which will populate the same.
Now after user does some edits on ListGrid and without saving them (setAutoSaveEdits is false), user goes ahead and changes the selection in ComboBoxItem which actually calls a fetch operation on ListGrid then ideally i should receive a confirm to discard edits. (with OK ,SAVE CANCEL buttons).
However before the ListGrid.fetchData i make a call ListGrid.InvalidateCache . This call to invalidate cache is making the ListGrid not capture the unsaved edits(as in not showing the confirm discard edit popup) to the ListGrid which makes me think that the unsaved edits are discarded BUT it is not discarding the edits. The next time i select the same record it is showing up the record with the edit value still existing.
Shouldn't InvalidateCache on ListGrid discard the unsaved edits as well ?
Following is my sample code..
The following use case explains,
There is one ComboBoxItem which has few records loaded in them. There is ListGrid just beneath the ComboBoxItem.
ComboItem has ChangeEvent (not Changed) Handler which captures user changes. Also this change triggers fetchData on ListGrid which will populate the same.
Now after user does some edits on ListGrid and without saving them (setAutoSaveEdits is false), user goes ahead and changes the selection in ComboBoxItem which actually calls a fetch operation on ListGrid then ideally i should receive a confirm to discard edits. (with OK ,SAVE CANCEL buttons).
However before the ListGrid.fetchData i make a call ListGrid.InvalidateCache . This call to invalidate cache is making the ListGrid not capture the unsaved edits(as in not showing the confirm discard edit popup) to the ListGrid which makes me think that the unsaved edits are discarded BUT it is not discarding the edits. The next time i select the same record it is showing up the record with the edit value still existing.
Shouldn't InvalidateCache on ListGrid discard the unsaved edits as well ?
Following is my sample code..
Code:
ComboBoxItem fileSelectItem = new ComboBoxItem("Select Item", "Select a Record"); fileSelectItem.setAddUnknownValues(Boolean.FALSE); fileSelectItem.setValueField("id"); fileSelectItem.setDisplayField("description"); fileSelectItem.setRequired(true); fileSelectItem.setWidth(600); final ListGrid grid = new ListGrid(); fileSelectItem .addChangeHandler(new com.smartgwt.client.widgets.form.fields.events.ChangeHandler() { @Override public void onChange(ChangeEvent event) { grid.invalidateCache(); grid.fetchData(new Criteria("key", "value")); } });
Comment