Hi
I have quite a special case regarding deletion of records and editorProperties in listGrids and can't figure out whether i'm doing something wrong or there is a bug in the listGrids implementation.
I created a quick example to demonstrate the issue:
Steps to produce the error:
1. delete all records in the listGrid by clicking the delete icon on the right.
2. click the Update button to update the editorProperties + listGrid data.
Doing so results in the following error once the last record is deleted:
And the following error once update is clicked:
Now i need an option for the user to delete records from the grid.
At the same time i need to be able to update the valueMap of the comboboxItem and the displayed records, since the suggestions + data can change.
(These updates always happen before or after the user is able to delte records)
I've already played around quite a bit, but couldn't find a solution to avoid these errors.
I'm using the latest build available as of writing this post (27.05.2015).
Maybe anyone has an idea?
Thanks in advance and best regards,
Seraksab
I have quite a special case regarding deletion of records and editorProperties in listGrids and can't figure out whether i'm doing something wrong or there is a bug in the listGrids implementation.
I created a quick example to demonstrate the issue:
Code:
public class Test implements EntryPoint {
@Override
public void onModuleLoad() {
GWT.create(BeanFactory.FormItemMetaFactory.class);
final VLayout layout = new VLayout();
layout.setHeight(300);
layout.setWidth(700);
final ListGrid listGrid = new ListGrid();
listGrid.setWidth100();
listGrid.setHeight100();
listGrid.setShowRowNumbers(false);
listGrid.setShowHeader(true);
listGrid.setCanEdit(true);
listGrid.setEditByCell(true);
listGrid.setAlwaysShowEditors(true);
listGrid.setShowAllRecords(true);
listGrid.setShowAllColumns(true);
listGrid.setShowFilterEditor(false);
listGrid.setAutoFetchData(false);
listGrid.setCanRemoveRecords(true);
listGrid.setSelectionType(SelectionStyle.NONE);
final ListGridField listGridField = new ListGridField("testField", "TestField"){
{
setAlign(Alignment.LEFT);
setEditorType(ComboBoxItem.class);
}
};
listGrid.addDrawHandler(new DrawHandler() {
@Override
public void onDraw(DrawEvent event) {
listGrid.setData(new Record[]{
new Record(){
{
setAttribute("testField","test1");
}
},
new Record(){
{
setAttribute("testField","test2");
}
}
});
}
});
listGrid.setFields(listGridField);
layout.addMember(listGrid);
layout.addMember(new IButton("Update"){
{
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
updateListGrid(listGrid,listGridField);
}
});
}
});
layout.draw();
}
private void updateListGrid(final ListGrid listGrid, final ListGridField listGridField) {
listGridField.setEditorProperties(new ComboBoxItem(){
{
// the valueMap may change and therefore needs to
// be ypdatedevery time updateListGrid() is called
setValueMap(new String[] { "test" });
}
});
listGrid.setFields(listGridField);
// the data are normally parsed from an XML (may have changed) every
// time updateListGrid() is called
listGrid.setData(new Record[]{
new Record(){
{
setAttribute("testField","test1");
}
}
});
}
}1. delete all records in the listGrid by clicking the delete icon on the right.
2. click the Update button to update the editorProperties + listGrid data.
Doing so results in the following error once the last record is deleted:
Code:
17:40:06.299:TMR0:WARN:Log:TypeError: Cannot read property 'getItems' of null
Stack from error.stack:
ListGrid.clearingInactiveEditorHTML(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Grids.js:1440:376
GridBody.redraw(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ ISC_Grids.js:771:48
ListGrid.redrawChildren(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Core.js:2072:554
ListGrid.updateHTML(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Core.js:2065:30
ListGrid.redraw(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Core.js:2061:705
[a][c]Class.invokeSuper(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Core.js:260:162
ListGrid.redraw(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Grids.js:1004:6
ListGrid.removeDataAnimationComplete(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Grids.js:2272:257
[c]Class.fireCallback(_1=>Obj, _2=>undef, _3=>Array[0], _4=>[GridBody ID:isc_ListGrid_0_body], _5=>true) @ ISC_Core.js:269:49
[a]ListGrid.fireCallback(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Core.js:337:302Code:
17:41:56.732:TMR6:WARN:Log:TypeError: Cannot read property 'getItems' of null
Stack from error.stack:
ListGrid.clearingInactiveEditorHTML(<no args: exited>) on[ListGrid ID:isc_ListGrid_0] @ ISC_Grids.js:1440:376
GridBody.redraw(<no args: exited>) on [GridBody ID:isc_ListGrid_0_body] @ ISC_Grids.js:771:48
[c]Canvas.clearRedrawQueue(<no args: exited>) @ ISC_Core.js:2902:110
[c]Class.fireCallback(_1=>Obj, _2=>undef, _3=>Array[0], _4=>[Class Canvas], _5=>true) @ ISC_Core.js:269:78
Timer._fireTimeout(_1=>"$ir44", _2=>56, _3=>undef) @ ISC_Core.js:1269:222
<anonymous>() @ ISC_Core.js:1267:40At the same time i need to be able to update the valueMap of the comboboxItem and the displayed records, since the suggestions + data can change.
(These updates always happen before or after the user is able to delte records)
I've already played around quite a bit, but couldn't find a solution to avoid these errors.
I'm using the latest build available as of writing this post (27.05.2015).
Maybe anyone has an idea?
Thanks in advance and best regards,
Seraksab