Bind form to tree in same dataset

I have a datastore that I can display as a grid and bind a form to it for editing the data - this is all working but is not exactly what I want…

I really want to change the grid to a tree and when I click on a tree node the form is populated with the data for that entry. The data items are hierarchical and I want to be able to display that and ultimately allow re-arranging with drag-n-drop.

I can display a tree if I use the tree_connector to load the data from my server - but I could not find a way to successfully bind the form to it - the form stayed blank. I figured it was because I use different data sources (tree_connector for the tree and DataSource for the form). However, I don’t see how I can use the same DataSource for this as it has no parent_id specification mechanism.

I am new and have tried to find an example in the documentation that shows how to do this, but nothing shows enough such that I can get it to work - the examples that I’ve found are too simplistic. Maybe I can’t do this with a simple binding?

What am I missing? Is there some example somewhere that shows this binding of a tree and form using the same dataset?

Thanks.

Hi,
you have to use something like here:

	var tree=new dhtmlXTreeObject("treebox","100%","100%",0);
	tree.setImagePath("../../../dhtmlxTree/codebase/imgs/csh_bluebooks/");
	tree.loadXML("../common/data/tree.xml")

	
	var formData = [
		{type: "label", label: "Selected record"},
		{type: "input", name: "text", value: "", 	labelWidth:100, label:"Book"}
	];
	var myform = new dhtmlXForm("gridbox3", formData);
	myform.bind(tree);

Thanks for the response, however it’s not what I am looking for in this case…

I want to load some data into a DataStore and then display a tree and a form based upon that common DataStore and bind the form to the tree for editing.

The documentation says that a DataStore can be used to load data once and then create rules for how it is used. However, in the “Data Binding in Code Samples” using a DataStore - even though it states that tree/treeGrid are applicable components, there is no example given and if I guess at how to use it based upon the other component examples then doesn’t work.

So, it it not possible to use a DataStore with a tree or does it just require some additional “wiring”?

Thanks.

It’s impossible to bind datastore to tree for now.
It may be implemented in the next release.

OK, good to know.

I’ve got the mechanism to work by loading the tree with a separate call to the server and then attaching an onSelect event to it that sets the cursor in the DataStore that is bound to the Form.

Thanks,
Neil