This is a migrated thread and some comments may be shown as answers.

[Solved] Adding Node in Q2

5 Answers 61 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rémy
Top achievements
Rank 1
Rémy asked on 19 Mar 2012, 09:56 AM
Hi,

I want to know how i can Add a node in the Q2 version. I saw this is one of the evolution of this version but I can't find any example...

Could you show me how can I use it ?

I want to apologize about my poor-english...

Rémy

5 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 19 Mar 2012, 10:27 AM
Hello Rémy,

The API for adding/removing nodes was introduced in 2012.Q1 and is not available previous releases. If you need to use it, you should upgrade. The API itself is demonstrated in the TreeView / client-side API example.

Regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Rémy
Top achievements
Rank 1
answered on 19 Mar 2012, 10:35 AM
Thank you for helpling me ! 

But I forgot to say I am using Razor language... I can see example about Adding Node in ASPX part but not in Razor Part.

And on ASPX part, we can add a node, but just on level 0. Is it possible to add in child ? 
0
Accepted
Alex Gyoshev
Telerik team
answered on 19 Mar 2012, 10:55 AM

Yes, we have an updated example that will be uploaded with the next release. You can supply the parent node for the added element as a parameter to the append/insert functions:

// append a new item to `foo`
treeview.append({ Text: "bar" }, treeview.findByText("foo"));

For more information, refer to the TreeView client API documentation.

All the best,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Rémy
Top achievements
Rank 1
answered on 19 Mar 2012, 02:47 PM
Thank you for your help !

I have a last question :

When I want to edit a node in the tree, I have to open a window containing the node's informations and I want to "rebind" (or something like that) the tree (without reload the page) when I submit the editing form. 

I use treeview like this : 

@(Html.Telerik().TreeView()
        .Name("TreeView")
                .BindTo(Model, mappings => mappings.For<AssociationCategoryChildModel>(binding => 
binding.ItemDataBound((item, category) =>
{ item.Value = category.Id.ToString(); item.Text = category.Name; }
)
	.Children(category => category.ChildCategory)))
	.ClientEvents(events => events
            .OnSelect("onSelect")
            .OnExpand("Expand")
            .OnCollapse("Collapse")
        )
)
0
Alex Gyoshev
Telerik team
answered on 20 Mar 2012, 08:02 AM
Hello Rémy,

In order to rebind the treeview without reloading the page, you'll need to use AJAX binding (you can use it alongside the server binding that you have in place). You can see various ways to setup the AJAX binding in the treeview / load on demand online example. After setting it up, you can use the ajaxRequest client-side method to rebind the whole treeview, or only the parent node of the edited node.

Kind regards,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
TreeView
Asked by
Rémy
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Rémy
Top achievements
Rank 1
Share this question
or