hasChildren mapping to custom field

3 posts, 1 answers
  1. Bojan
    Bojan avatar
    4 posts
    Member since:
    Jul 2014

    Posted 08 Jul 2015 Link to this post

    I'm unable to map hasChildren model property to a custom field (in my case, I'm calling Web API method that returns array of custom objects, each having HasChildren set to true/false). I have tried:

    hasChildren: "HasChildren" 

    but it does not work in 2015.2.624 version of Kendo UI. However, this does work for HierarchicalDataSource (TreeView).

    This DOES work (I consider this a work-around for now):

    1) Setting the name of the property in my C# code to hasChildren (lowercase H)

    Is this a known issue?

  2. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 10 Jul 2015 Link to this post

    Hello Bojan,

     

    Indeed currently the TreeListDataSource expects hasChildren. The only way you could project HasChildren to hasChildren is to define such field in the model:

     

    fields: {
     id: { type: "number" },
     parentId: { type: "number", defaultValue: 0 },
     hasChildren: { type: "boolean", field: "HasChildren" }
    }

     

    Example - http://dojo.telerik.com/@rusev/uMonE

     

    Regards,
    Nikolay Rusev
    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
  4. Bojan
    Bojan avatar
    4 posts
    Member since:
    Jul 2014

    Posted 13 Jul 2015 in reply to Nikolay Rusev Link to this post

    Thank you Nikolay. That was it!
Back to Top