Hi!
I have following issue: if "this" keyword used in source binding, MVVM recreates the whole DOM starting from this node if any child value of "this" observable model changes. here is a fiddle to reproduce it:
http://jsfiddle.net/uBgnr/21/
If instead of "this" model member is used, DOM is not recreated, here is another fiddle:
http://jsfiddle.net/uBgnr/20/
In this case I could avoid this behavior, but I have following scenario and I could not change data structure:
I have an array of elements to be bind in a div. But the problem is: each of element has it's own template, stored in field "template", so I could do following:
this will work, but as I said if any child field of my view model will be changed, MVVM recreates div with "source:this" binding
using "#if" inside element template is not an option, templates are huge, and could be used also not only within "elements" binding, so I need to copy/paste them, its dirty.
Suggestion: it would be nice something like this:
Please help.
I have following issue: if "this" keyword used in source binding, MVVM recreates the whole DOM starting from this node if any child value of "this" observable model changes. here is a fiddle to reproduce it:
http://jsfiddle.net/uBgnr/21/
If instead of "this" model member is used, DOM is not recreated, here is another fiddle:
http://jsfiddle.net/uBgnr/20/
In this case I could avoid this behavior, but I have following scenario and I could not change data structure:
I have an array of elements to be bind in a div. But the problem is: each of element has it's own template, stored in field "template", so I could do following:
<
div
data-template
=
"element"
data-bind
=
"source:elements"
></
div
>
<
script
id
=
"element"
type
=
"text/x-kendo-template"
>
<
div
data-template
=
"#=template#"
data-bind
=
"source:this"
></
div
>
</
script
>
this will work, but as I said if any child field of my view model will be changed, MVVM recreates div with "source:this" binding
using "#if" inside element template is not an option, templates are huge, and could be used also not only within "elements" binding, so I need to copy/paste them, its dirty.
Suggestion: it would be nice something like this:
<
div
data-template-field
=
"template"
data-bind
=
"source:elements"
>
Please help.