You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lxw_first <lx...@hotmail.com> on 2012/08/10 09:37:52 UTC

How to update the treetable

I created a treetable with a treemodel based on database schema. I am trying
to refresh the treetable so that it will change it's data after some db
update.
I update viat the button event.the button event work but treetable doesn't
change.
To create treetable i have this on my page:

treeTable = new TreeTable("treeTable", createTreeModel(), columns);
treeTable.getTreeState().setAllowSelectMultiple(true);
treeTable.setRootLess(true);
treeTable.getTreeState().collapseAll();
creatForm.add(treeTable);

the createTreeModel code:
protected TreeModel createTreeModel() {
	DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
	initTree(roleList, rootNode);
	TreeModel treeModel = new DefaultTreeModel(rootNode);
	return treeModel;
}

i add the button event like this:
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
	roleList.clear();
	treeTable.updateTree(target);
	target.add(getForm(),treeTable);
}

Any idea or reference to documentation that explain this?
thanks.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-the-treetable-tp4651122.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: How to update the treetable

Posted by lxw_first <lx...@hotmail.com>.
Hiļ¼ŒPaul Bors.

Thanks for your help.

Just need to setModelObjec to treetable.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-update-the-treetable-tp4651122p4651160.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: How to update the treetable

Posted by Paul Bors <pa...@bors.ws>.
Since Wicket's TreeTable uses Java's javax.swing.tree.TreeModel, I would
check out Oracle's tutorial on How To Use Trees (JTree).

More precisely the Dynamically Changing a Tree section:
http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html#dynamic

See if that helps you.

~ Thank you,
  Paul Bors

-----Original Message-----
From: lxw_first [mailto:lxw_first@hotmail.com] 
Sent: Friday, August 10, 2012 3:38 AM
To: users@wicket.apache.org
Subject: How to update the treetable

I created a treetable with a treemodel based on database schema. I am trying
to refresh the treetable so that it will change it's data after some db
update.
I update viat the button event.the button event work but treetable doesn't
change.
To create treetable i have this on my page:

treeTable = new TreeTable("treeTable", createTreeModel(), columns);
treeTable.getTreeState().setAllowSelectMultiple(true);
treeTable.setRootLess(true);
treeTable.getTreeState().collapseAll();
creatForm.add(treeTable);

the createTreeModel code:
protected TreeModel createTreeModel() {
	DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
	initTree(roleList, rootNode);
	TreeModel treeModel = new DefaultTreeModel(rootNode);
	return treeModel;
}

i add the button event like this:
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
	roleList.clear();
	treeTable.updateTree(target);
	target.add(getForm(),treeTable);
}

Any idea or reference to documentation that explain this?
thanks.



--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-update-the-treetable-tp465
1122.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org