This is a migrated thread and some comments may be shown as answers.

MVVM View, evalTemplate

3 Answers 64 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Carsten Koster
Top achievements
Rank 2
Carsten Koster asked on 04 Dec 2014, 10:49 AM
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/

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 05 Dec 2014, 09:23 AM
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!
 
0
Elvis
Top achievements
Rank 1
answered on 31 Jan 2017, 03:41 PM

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?

0
Stefan
Telerik team
answered on 02 Feb 2017, 02:37 PM
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 (charts) and form elements.
Tags
MVVM
Asked by
Carsten Koster
Top achievements
Rank 2
Answers by
Petyo
Telerik team
Elvis
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or