Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
Beginner questions regarding jQueryTree control
posted

I have three questions regarding the jQuery tree. I am using MVC3 and razor.

I have set up the tree using code in the controller:

TreeModel treeModel1 = new TreeModel();
treeModel1.ID = "TreeInController1";
// Configure data source
treeModel1.DataSource = col1;

// Configure specific display and interraction properties
treeModel1.LoadOnDemand = true;
treeModel1.DataSourceUrl = Url.Action("TreeGetData");
treeModel1.CheckboxMode = CheckboxMode.TriState;
treeModel1.SingleBranchExpand = true;
treeModel1.ParentNodeImageUrl = "Computer.png";
treeModel1.LeafNodeImageUrl = "Computer.png";

// Define bindings
treeModel1.Bindings = new TreeBindings();
treeModel1.Bindings.TextKey = "Name";
treeModel1.Bindings.PrimaryKey = "StateId";
treeModel1.Bindings.ValueKey = "StateId";
//treeModel1.Bindings.ImageUrlKey = "ImageUrl";
treeModel1.Bindings.ChildDataProperty = "Courts";

1) How do you set the child leaves Bindings using code in the controller? 

2) How do you change the icon of a distinct leaf item using code in the controller?

3) How do you return the selected items to the controller?

Parents
  • 5105
    Verified Answer
    Offline posted

    Hi there,

    Thank you for using the Infragistics Tree control. To answer your questions:

    1. The Bindings model has a recursive definition. That means that every Bindings model can have Bindings defined, which is the definition for the child level bindings.

    2. You cannot use the LeafNodeImageUrl property to define an image for a distinct leaf item. However the data can carry ImageUrl for a distinct item and so you can configure the ImageUrlKey in the corresponding level of bindings and have the icon displayed for that item.

    3. There is no out of the box method of delivering the selected item back to the controller. However you can define a controller action that takes as an argument some specific property of the item and have a button/event handler/etc which calls the action with the parameter that you want to pass to the controller (in this case the selected item.

    Let me know if this information helps in any way!

Reply Children