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

How to add Data field to load from server?

1 Answer 70 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Kuangyi
Top achievements
Rank 1
Kuangyi asked on 01 Oct 2012, 03:47 PM
I'm trying to get a HierarchicalDataSource from my server, but I need to pass in specific values.  I can't figure out how it's done and have tried following DataSource's documentation. 

It breaks when it tries the .read().  When I specify "read" it says "TypeError: Illegal invocation ", when I specify "create" it says "Cannot read property 'data' of undefined ".

I'm currently doing:

    var param1= ...;
    var param2 = ...;

        var dataSource = new kendo.data.HierarchicalDataSource({
            transport: {
                read: {
                    url: "/Home/GetStuff",
                    dataType: "json",
                    data: { param1: param1, param2: param2 }
                }
            },
            schema: {
                model: { id: "id", hasChildren: "hasChildren", children: "items" }
            }
        });


        dataSource.read();

My server method is public ActionResult GetStuff(Guid param1, Guid param2)

As per DataSource's docs, I tried using "create", as well as trying create: function(options) {... .ajax... }.

1 Answer, 1 is accepted

Sort by
0
Kuangyi
Top achievements
Rank 1
answered on 01 Oct 2012, 04:53 PM
nvm I was passing in an entire input instead of the value to param2.
Tags
Hierarchical Data Source
Asked by
Kuangyi
Top achievements
Rank 1
Answers by
Kuangyi
Top achievements
Rank 1
Share this question
or