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

hasChildren mapping to custom field

2 Answers 127 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Bojan
Top achievements
Rank 1
Bojan asked on 08 Jul 2015, 04:29 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Rusev
Telerik team
answered on 10 Jul 2015, 06:20 AM

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!
 
0
Bojan
Top achievements
Rank 1
answered on 13 Jul 2015, 08:46 AM
Thank you Nikolay. That was it!
Tags
TreeList
Asked by
Bojan
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Bojan
Top achievements
Rank 1
Share this question
or