I prepared a simple dojo here: http://dojo.telerik.com/iQERE
Scenario:
I have an array within another array and I wanted to render it with a kendo template in a sort of table/grid. First array's items are the rows and inner array's items are the columns.
I googled and found this technique: template inside template
The problems are:
1) How can I bind values for the nested array's items?
I tried data-bind="value:subval"
but it doesn't work.
I think because using that technique the 'real data' of this template is the outer array, not the inner one!
Tried data-bind="value: item.subval"
- leaded to nothing.
So finally I tried data-bind="value: subList[#:index#].subval"
and it works. But I ask myself: Is this correct?
2) How can I bind the value to a function in the nested template? (famous kendo mvvm calculated fields).
I hoped I could bind all the input to a unique function who takes the 'caller' value and do something (multiply for another model field for example).
But I can't get rid who called the function... my "e"
argument is the whole data!!
After some experiments I tried this way: http://dojo.telerik.com/OpOja and first time works... but it seems the function doesn't trigger when the value1 of the model change (wich I would expect in a normal mvvm behavior), maybe because I declared the function inside the dataSource
. (it's not an observable
object itself?)
I hope I explained well my problem!