MVVM View, evalTemplate

4 posts, 0 answers
  1. Carsten Koster
    Carsten Koster avatar
    25 posts
    Member since:
    Sep 2006

    Posted 04 Dec 2014 Link to this post

    Hey just a quick thing,

    I tried to use a kendo.View fed by html containing kendo-template expressions:
       
     var viewModel = kendo.observable({       
            test: '123'
     }); 
    var
    myFailedView = new kendo.View('<span data-bind="text: test"></span> #: location.href #', { model:viewModel, evalTemplate: true });

    var mySucessfulView = new kendo.View('##<span data-bind="text: test"></span> #: location.href #', { model:viewModel, evalTemplate: true });

    I would expect it to render  a span with 123 followed by the current location of the browser. But it only renders the span. If I start with an empty template expression "##" it behaves as expected. Is that a bug or did I miss something in the documentation?

    For reference see JsFiddle

    Regards,
    Kris


    http://jsfiddle.net/9y36opsk/

  2. Petyo
    Admin
    Petyo avatar
    2442 posts

    Posted 05 Dec 2014 Link to this post

    Hello Carsten,

    Thank you for the reproduction. This is a known issue, but due to its relatively limited usage we have not investigated it further. The evalTemplate will work as expected if the view is created from a script template. Our API reference shows this approach

    I will log the problem in our GitHub repository, we will try to address it shortly. 
     
    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Elvis
    Elvis avatar
    7 posts
    Member since:
    Feb 2015

    Posted 31 Jan Link to this post

    Hello there, 

        We faced with issue, related to evalTemplate: true. In details,  We used it for compiling template and binding to MVVM model. The problem is that it compiles only first time (the time when the view is initialized) and then it uses the compiled version with MVVM model, that is already changed. Here is the dogo, that demonstrates this behaviour: http://dojo.telerik.com/AgIYi . I know, we could fix it by separating the MVVM and kendo template and then use kendo.template and kendo.bind manually, but may be I missed something?

  4. Stefan
    Admin
    Stefan avatar
    581 posts

    Posted 02 Feb Link to this post

    Hello Elvis,

    After investigating the scenario I can confirm that this is currently a limitation.

    The provided workaround can be used in this scenario.

    Thank you for sharing it with the community.

    Regards,
    Stefan
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top