Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 8th Feb 2010, 21:52
TheOne TheOne is offline
Registered Developer
 
Join Date: Feb 2010
Posts: 2
Default Edit Treegrid without Datasource (user generated Data)

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);
To add child nodes i create them as same like the mainNode and use the add(node, parent) Method. I try also to set the title attribute, but that doesn't change anything.

Can someone help me with that, please?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved