Refreshing TreeMap with angularjs

4 posts, 0 answers
  1. Andrey
    Andrey avatar
    2 posts
    Member since:
    Oct 2015

    Posted 23 Oct 2015 Link to this post

    I have TreeMap on my page as directive:

    <div kendo-treemap="kTree" k-options="widget.options" k-rebind="widget.options"  style="height:{{widget.options.height-30}}px;"></div>

    Sometimes i should change size of widget. ​But when i change height and width and call 

    .scope().kTree.resize()

    it's nothing happens. Does it ridht way? How i can dynamicly change size of TreeMap?

    Thanks.

  2. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 27 Oct 2015 Link to this post

    Hello Andrey,

    If the size of the element is changed by changing a field in the options then please check this example and let me know if I as missing something. From the code it seems that k-rebind is used and the height field is in the options so the treemap should automatically be recreated and the calling resize should not be needed.

    Regards,
    Daniel
    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. Andrey
    Andrey avatar
    2 posts
    Member since:
    Oct 2015

    Posted 19 Nov 2015 in reply to Daniel Link to this post

    Hi, Daniel.
    Your example works, but I need to make it work with static data not loaded from somewhere.
    Here in my example ( http://dojo.telerik.com/ovuDO ) I copied the JSON string directly to the scripts section, and as you can see now treemap doesn't redraw itself correctly.
    Is this a bug and how can I make it work?
  5. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 23 Nov 2015 Link to this post

    Hello again,

    The approach will not work for local data because the treemap will be rebound before the element height is updated. In this case you could  implement a custom directive that calls the resize method after setting the new height(example) or use a timeout to call the resize method.

    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready