Multiple Children fields?

2 posts, 0 answers
  1. Tom
    Tom avatar
    1 posts
    Member since:
    Dec 2014

    Posted 09 Dec 2014 Link to this post

    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
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 11 Dec 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top