How to add Data field to load from server?

2 posts, 0 answers
  1. Kuangyi
    Kuangyi avatar
    30 posts
    Member since:
    Sep 2011

    Posted 01 Oct 2012 Link to this post

    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... }.
  2. Kuangyi
    Kuangyi avatar
    30 posts
    Member since:
    Sep 2011

    Posted 01 Oct 2012 Link to this post

    nvm I was passing in an entire input instead of the value to param2.
  3. Kendo UI is VS 2017 Ready
Back to Top