我们有基本的ListGrid,其中一个字段是可编辑的,并且总是应该显示该字段的编辑器,这里是创建代码
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);
可在此处创建可编辑字段
ListGridField manualScoreColumn = new ListGridField("score", "Score");
manualScoreColumn.setType(ListGridFieldType.INTEGER);
manualScoreColumn.setCanEdit(true);
manualScoreColumn.setValidateOnChange(true);
manualScoreColumn.setValidators(new IntegerRangeValidator());
当使用过滤ListGrid中的数据时,问题
listPanel.setCriteria(criteria);
我们得到这样的例外
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() @
有任何解决方法吗? 谢谢。
答案 0 :(得分:0)
确保已将ListGridField设置为ListGrid
listPanel.setFields(manualScoreColumn);
将您选择的编辑器设置为ListGridField的另一种方法是使用setEditorType方法
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);