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

Multiple Children fields?

1 Answer 147 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 09 Dec 2014, 09:46 PM
Hi,

The nodes comprising my HierarchcalDataSource possess two fields that hold potential children and all children from both fields need to be displayed in my kendoTreeView.  But the model.children property only allows specifying a single field (I believe - still very new to this).  Basically I am looking for something that does the following where the two children fields are idenfied as 'Children1' and 'Children2':

dataSource: new kendo.data.HierarchicalDataSource({
         schema: {
               model: { id: "Id",
                             hasChildren: function (item) {
                                            return ((item.Children1 != null && item.Children1.length > 0) ||
                                                        (item.Children2 != null && item.Children2.length > 0));
                             },
                             children: "Children1" or "Children2"
                }
         }
}

Thank you,
Tom

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 11 Dec 2014, 02:30 PM
Hello Tom,

Indeed children can be only string and you can reference only one field. However you can define parse function and normalize/merge those fields into one.

Here is a quick example for the idea: http://dojo.telerik.com/@rusev/iZAR.

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Hierarchical Data Source
Asked by
Tom
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or