TreeView causes "Maximum call stack size exceeded" error when binding to BreezeJS entities

4 posts, 0 answers
  1. Randy
    Randy avatar
    3 posts
    Member since:
    Aug 2014

    Posted 27 Aug 2014 Link to this post

    I'm using kendoTreeView, with Angular and BreezeJS.  When I bind directly to the breeze entities, this results in a stack overflow scenario.  I assume this is because the breeze entities have circular references with them.

    For example, each breeze entity has an "entityAspect" property to track entity state, which contains a reference back to the entity itself.  I.e. myEntity.entityAspect.Entity -> myEntity.

    In addition, some entities may contain circular references within the model.  For example, Customer->Order->Customer.  

    Is there a way to configure the kendoTreeView to ignore cycles, or to ignore certain paths within the object graph?
  2. Randy
    Randy avatar
    3 posts
    Member since:
    Aug 2014

    Posted 29 Aug 2014 Link to this post

    Here is some sample code.  Note that the otherData is the part that contains the circular reference.  I don't need to display the otherData.  How can I tell the treeview to ignore this property?

    01.var dataManager = {};
    02.var otherDataNotToDisplay = [{
    03.    text: "something else 1",
    04.    rootManager: dataManager // NOTE it refers to the root data manager
    05.}];
    06. 
    07.dataManager.data = [{
    08.        text: "Test1", Id: 1,
    09.        hasKids: false,
    10.        myKids: {},
    11.        otherData: otherDataNotToDisplay // NOTE this leads to the other object which causes a circular reference
    12.    },
    13.    {
    14.        text: "Test2", Id: 2,
    15.        hasKids: false,
    16.        myKids: {}
    17.    }];
    18. 
    19.var dataSource = new kendo.data.HierarchicalDataSource({
    20.    data: dataManager.data,
    21.    schema: {
    22.        model: {
    23.            hasChildren: 'hasKids',
    24.            children: "myKids",
    25.                 
    26.        }
    27.    }
    28.});
    29. 
    30.vm.treeData = dataSource;

  3. Kendo UI is VS 2017 Ready
  4. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 29 Aug 2014 Link to this post

    Hello Randy,

    The problem is more general than the TreeView -- see this Dojo snippet on a minimal reproduction with kendo.observable. I am afraid that circular references are not supported, nor have we claimed compatibility with BreezeJS. However, you can use the breeze-kendo library if you wish.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Randy
    Randy avatar
    3 posts
    Member since:
    Aug 2014

    Posted 29 Aug 2014 in reply to Alex Gyoshev Link to this post

    Alex, thanks for the response.  I agree, the problem is more general... I also get the error when binding to the kendogrid.  The dojo snippet demonstrates the problem exactly.   I have seen the breeze-kendo library, and it does work, however I was hoping to be able to bind to entities already fetched locally, rather than using the entity manager to query them every time (as the breeze-kendo data source does).
Back to Top
Kendo UI is VS 2017 Ready