SmartGwt ListGrid.setAlwaysShowEditors(true) issue

983 Views Asked by At

We have basic ListGrid where one of the fields is editable and editor for this field always should be displayed, here is creation code

ListGrid listPanel = new ListGrid();
listPanel.setDataFetchMode(FetchMode.PAGED);
listPanel.setDataSource(datasource);
listPanel.setAutoFetchData(true);
listPanel.setAlwaysShowEditors(true);
listPanel.setCanEdit(true);
listPanel.setAutoSaveEdits(false);
listPanel.setSaveByCell(false);
listPanel.setEditOnFocus(true);
listPanel.setEditEvent(ListGridEditEvent.CLICK);

editable field is created here

ListGridField manualScoreColumn = new ListGridField("score", "Score");
manualScoreColumn.setType(ListGridFieldType.INTEGER);
manualScoreColumn.setCanEdit(true);
manualScoreColumn.setValidateOnChange(true);
manualScoreColumn.setValidators(new IntegerRangeValidator());

problem is when data in ListGrid is filtred using

listPanel.setCriteria(criteria);

we get such exeption

12:42:31.204:RDQ2:WARN:Log:TypeError: _5 is null
ListGrid._clearingInactiveEditorHTML() @ adminApp/sc/modules/ISC_Grids.js:1530
GridBody.redraw(_1=>false) @ adminApp/sc/modules/ISC_Grids.js:889
[c]Canvas.clearRedrawQueue() @ adminApp/sc/modules/ISC_Core.js:3300
[c]Class.fireCallback(_1=>{Obj},  _2=>undef,  _3=>[object Array],  _4=>{Obj}, _5=>true)
@ adminApp/sc/modules/ISC_Core.js:299
Timer._fireTimeout("$ir2251") @ adminApp/sc/modules/ISC_Core.js:1269
unnamed() @ adminApp/sc/modules/ISC_Core.js:1264
unnamed() @ 

I've found similar question here and here but no solution was proposed.

Are there any workarounds ? Thanks.

1

There are 1 best solutions below

0
On

Make sure you have set ListGridField to ListGrid

 listPanel.setFields(manualScoreColumn);

Another way to set editor of your choice to ListGridField is to use setEditorType method

    ListGrid listPanel = new ListGrid();
    listPanel.setCanEdit(true);
    listPanel.setAutoSaveEdits(false);

    //You can use any formitem instead of date item,Say TextItem,SelectItem etc
    DateItem dateItem = new DateItem();
    ListGridField dateListGridField= new ListGridField("date", "Date");
    dateListGridField.setEditorType(dateItem);
    listPanel.setFields(dateListGridField);