Issues using MVVM and calling setOptions...

3 posts, 1 answers
  1. Robin
    Robin avatar
    46 posts
    Member since:
    Jul 2012

    Posted 25 Sep 2013 Link to this post

    I have a chart built using MVVM, and am trying to programmatically set the select to and from on the categoryAxis.

    I can get this to work using a non-mvvm chart (http://jsbin.com/OXESAyi/2/edit),
    but on an MVVM chart the chart just craps out with no console error (http://jsbin.com/ifeZAZU/3/edit).
    Even following the sample from http://docs.kendoui.com/api/dataviz/chart#methods-setOptions and just trying to change the theme, does the same thing.

    Is there some better way of programmatically setting the select than using the setOptions method ?

    Thanks.

    Robin
  2. Answer
    Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 27 Sep 2013 Link to this post

    Hi Robin,

    Thank you for the provided examples. Using the MVVM approach binds the dataSource after the widget is initialized and currently the setOptions method decides whether to refresh or redraw the Chart based on whether or not there is a dataSource in the original Chart options. This is the reason for that unexpected behavior, and until a fix is released  I would recommend either adding an empty dataSource to the data-attributes or call the Chart's refresh method right after calling setOptions. Here is an example illustrating both of the approaches I suggested.

    As a small token of appreciation for bringing this to our attention, I updated your Telerik points.
     

    Regards,
    Alexander Popov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Robin
    Robin avatar
    46 posts
    Member since:
    Jul 2012

    Posted 27 Sep 2013 Link to this post

    That is an easy work-around. 

    Thank you for the reply.
Back to Top