我有一個問題,肯德斯的列表視圖,如果我編輯一行另一個從附加的數據源中刪除。這在我編輯第一行時正常工作,但是當我編輯另一行時,第一行被刪除。Kendoui ListView刪除在編輯模式下的行
我注意到在編輯第一行listview的編輯函數時會先調用,但是當我編輯第二行數據綁定時,會調用databound然後編輯。
這裏是代碼:
var dataSource = new kendo.data.DataSource({
transport: {
read: function (options) {
options.success(lst);
},
update: function (options) {
oThis.httpService.Post('api/DynamicPricing/UpdateDynamicItem', lst)
.success(function (data, status) {
options.success(data);
});
},
schema: {
model: {
id: "Id",
fields: {
Name: { type: "string" },
CategoryF: { type: "string" },
DirectCost: { type: "number" },
IndirectCost: { type: "number" },
StrategyType: { type: "string" },
Value: { type: "string" },
OverridePrice: { type: "number" },
Current: { type: "string" }
}
}
}
});
list = $('#listcontent').kendoListView({
template: kendo.template('<table cellpadding="3px" class="gridDynamicPricingContent"><tr> \
<td width="100px">#:Name#</td> \
<td width="100px">#:CategoryF#</td> \
<td width="100px" align="right">#:DirectCostF#</td> \
<td width="100px" align="right">#:IndirectCostF#</td> \
<td width="100px">#:StrategyType#</td> \
<td width="50px">#:Value#</td> \
<td width="100px" style="text-align:right; padding-right:5px;" >#:OverridePriceF#</td> \
<td width="100px">#:Current#</td > \
<td width="100px"><a class="k-button k-edit-button" href = "\\#"><span class="k-icon k-edit"></span></a></td>\
</tr></table>'),
editTemplate: kendo.template('<table class="gridDynamicPricingContent k-state-selected"><tr> \
<td width="100px">#:Name#</td> \
<td width="100px">#:CategoryF#</td> \
<td width="100px" align="right">#if(DynamicPricingType==5){# #:data.DirectCost# #}else{#<input type="number" style="width:60px;" class="k-textbox" data-bind="value:DirectCost" name="DirectCost" />#}#</td> \
<td width="100px" align="right">#:IndirectCost#</td> \
<td width="100px">#:StrategyType#</td> \
<td width="50px">#:Value#</td> \
<td width="100px" style="text-align:right; padding-right:5px;">#if(DynamicPricingType==4 || DynamicPricingType==5){#<input type="number" class="k-textbox" style="width:60px;" data-bind="value:OverridePrice" name="OverridePrice" />#}else{# #:data.OverridePrice# #}#</td> \
<td width="100px">#:Current#</td > \
<td width="100px"><a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span></a></td> \
</tr></table>'),
dataSource: dataSource,
selectable: true,
dataBound: function() {
$('#listcontent').prepend(header);
}
});//.data("kendoListView");
什麼是「API/DynamicPricing/UpdateDynamicItem的迴歸?只是一個項目正在更新,或所有項目的整個列表? – CodingWithSpike 2014-11-05 21:30:52
它返回所有項目並且它是不相關的,因爲不會調用更新。 – Haris 2014-11-10 07:33:15