0
我是Kendo的新手,並且遇到了將小部件應用到動態KO數組的問題。我有一個可觀察數組加載一組初始元素,並允許通過樣式將kendoNumericTextBox應用於每個框。然而,在向數組添加元素之後,Kendo小部件不再顯示。我創建了一個顯示行爲的小提琴。Knockout ObservableArray - 如何將Kendo小部件應用到新實例
http://jsfiddle.net/fiddlesticks66/WekFG/
查看
<code>
<div data-bind="foreach:rows">
<input class="percentage" data-bind="value:percent" />
</div>
<button data-bind="click:addRow">add row</button>
</code>
VM
<code>
function newVM(){
self=this;
self.rows = ko.observableArray([
{ percent: 0 },
{ percent: 0.25 },
{ percent: 0.50 } ]);
self.addRow = function(){
this.rows.push({percent:0});
};
return self;
}
</code>
JS申請劍道
<code>
$(".percentage").kendoNumericTextBox({
format: "p0",
min: 0,
max: 1,
step: 0.25
}).data("kendoNumericTextBox");
</code>
在此先感謝