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

How to change DataSource.Read URL after initial read

0 Answers 190 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Wasae
Top achievements
Rank 1
Wasae asked on 12 Mar 2013, 03:01 PM
Hi,
I have a tree view which uses dynamic loading from server when expanded. In my case there are two different URL's from where the initial and the child data is to be fetched. I tried changing the read URL from script but it is defaulted back when the user expands the tree which should not be the case.

Below is my tree
@(Html.Kendo().TreeView()
        .Name("MyTree")
        .DataTextField("Name")
        .DataSource(dataSource => dataSource
            .Read(read => read.Url("../api/User/?getAll=false").Type(HttpVerbs.Get))
        )
    )

I then change the read url in script as following 

 var tree = $("#MyTree").data("kendoTreeView");
 tree.dataSource.transport.options.read.url =  "../api/User/?getChildren=true";

But when the tree is expanded the URL is still /api/User/?getAll=false&id=1 instead of ./api/User/?getChildren=true&id=1

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Wasae
Top achievements
Rank 1
Share this question
or