|
#1
|
|||
|
|||
|
Hi, i am new to smartgwt and have a problem. I am building an editor with a TreeGrid at the left that is filled by user actions (like an Outline). Everything of the Tree is displayed fine, but i want to editable the cells. I set setCanEdit(true) and if i doubleclick the cell the editor mode starts.
Here comes my problem, i do not understand what field is editing. I think my problem belongs to the fact that i don't use any data source for my TreeGrid. If i edit the cell and hit enter the old value is still displayed. If i edit the cell again, my previous entered value is displaying, so the TreeGrid must save them in some field, but where? Here is my Tree and TreeGrid code Code:
setModelType(TreeModelType.PARENT);
setIdField("id");
setNameProperty("name");
mainNode= new TreeNode();
mainNode.setAttribute("id", idCounter);
mainNode.setAttribute("name", localizer.MainNodeCaption());
setData(new TreeNode[] {mainNode});
Code:
setWidth(160);
setHeight100();
setShowConnectors(true);
setShowResizeBar(true);
setCanEdit(true);
setModalEditing(true);
TreeGridField field = new TreeGridField(localizer.OutlineFieldCaption());
field.setCellFormatter(new CellFormatter() {
public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
return record.getAttribute("name");
}
});
setFields(field);
Can someone help me with that, please? |