AngularJS Databind odata to kendoui diagram

2 posts, 0 answers
  1. Wit
    Wit avatar
    43 posts
    Member since:
    Aug 2014

    Posted 06 Aug 2014 Link to this post

    I am trying to databind ASP.NET web api odata v3 to kendoui diagram
    control. It works OK with local data source but I am getting error when
    trying to use odata

    Error:

    Uncaught TypeError: Cannot read property '__count' of undefined

    HTML

    <div kendo-diagram="diagram" k-options="options" />


    AngularJS
    $scope.options = {
    dataSource: {
    type: "odata",
    transport: {
    read: {
    url: "odata/Entities",
    dataType: "json",
    type: "GET"
    }
    }
    },
    shapeDefaults: {
    visual: visualTemplate
    },
    layout: {
    type: "tree"
    },
    schema: {
    data: "value"
    }
    };



    function visualTemplate(options) {
    var dataviz = kendo.dataviz;
    var g = new dataviz.diagram.Group();
    var dataItem = options.dataItem;

    g.append(new dataviz.diagram.Rectangle({
    width: 210,
    height: 75,
    stroke: {
    width: 0
    },
    fill: "green"
    }));

    g.append(new dataviz.diagram.TextBlock({
    text: dataItem.Name,
    x: 85,
    y: 20,
    color: "#fff"
    }));

    return g;
    }

    json

    {
    "odata.metadata":"http://localhost/TestSPA/odata/$metadata#Entities","odata.count":"5","value":[
    {
    "EntityRef":7,"Name":"Test"
    }
    ]
    }
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 07 Aug 2014 Link to this post

    Hello,

    I'm copying the response from your ticket for community reference:

    Currently, the Kendo UI DataSource supports only OData v2. Using a v3 source is possible for reading data, using the workaround described in this answer on SO.
    We're currently gathering feedback regarding OData v3 and v4 support. Please, feel free to share your opinion and vote for this feature.

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top