Kendo UI Inline编辑事件未触发 [英] Kendo UI Inline editing events not firing
本文介绍了Kendo UI Inline编辑事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
@ model ProductModel
@ if (Model 。 Id > 0)
{
< table class =adminContent >
< tr>
< td>
< div id =customers-grid> < / div >
< script>
$(document).ready(function(){
$(#customers-grid)。 kendoGrid({
dataSource : {
type:json ,
运输:{
读取:{
url:@ Html.Raw(Url.Action(ProductCustomPriceModelList,Product,new {productId = Model.Id} )),
type : POST,
dataType:json,
data:addAntiForgeryToken
}
,
update : {
url:@ Html.Raw(Url.Action(ProductCustomPriceModelUpdate ,产品)),
类型:POST,
dataType:json,
数据:addAntiForgeryToken
} ,
destroy : {
url:@ Html .Raw(Url.Action(ProductCustomPriceModelDelete,Product)),
类型:POST,
dataType:json,
data:addAntiForgeryToken
}
},
架构: {
数据 : 数据,
总计:总计,
型号:{
id:Id,
字段:{
Id:{type:number} ,
CurrencyId : {editable:false,type:number} ,
价格 : {editable:true,type: number} ,
OldPrice : {editable:true,type:number} ,
ProductCost : {editable:true,type:number} ,
SpecialPrice : {editable:true,type:number} ,
SpecialPriceStartDateTimeUtc : {editable:true,type:date} ,
SpecialPriceEndDateTimeUtc : {editable:true,type:date}
}
}
} ,
错误: function(e){
display_kendoui_grid_error(e);
// 取消更改
this 。 cancelChanges();
} ,
pageSize: 10 ,
serverPaging: true ,
serverFiltering: true ,
serverSorting: true
} ,
pageable: {
刷新 : true,
pageSizes:10
} ,
可滚动 : false,
列: [
{
field:CurrencyId,
title:CurrencyId,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
字段 : Price,
title:Price,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
字段 : OldPrice,
标题: OldPrice,
//整数格式
///格式:{0:0} ,
width : 50
} ,{
字段 : ProductCost,
title:ProductCost,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
field : SpecialPrice,
title:SpecialPrice,
//整数格式
// for mat:{0:0} ,
width : 50
} ,{
field : SpecialPriceStartDateTimeUtc,
title:SpecialPriceStartDateTimeUtc,
type:date,
format:{0:G} ,
width : 50
} ,{
字段 : SpecialPriceEndDateTimeUtc,
title:SpecialPriceEndDateTimeUtc,
类型:date,
格式:{0:G} ,
width : 50
}
,
{命令 : [edit,destroy],标题:& nbsp; , width : 160px}
]
});
});
< / script >
< / td >
< / tr >
< / table >
}
else
{
否 数据
}
解决方案
(document).ready(function(){
(#customers-grid )。 kendoGrid({
dataSo urce : {
type:json,
transport:{
读取:{
url:@ Html.Raw(Url.Action(ProductCustomPriceModelList,Product,new {productId = Model.Id} )),
< span class =code-attribute> type : POST,
dataType: json,
数据:addAntiForgeryToken
}
,
update : {
url:@ Html.Raw(Url.Action(ProductCustomPriceModelUpdate,Product)),
类型:POST,
dataType:json,
数据:addAntiForgeryToken
} ,
destroy : {
url:@ Html .Raw(Url.Action(ProductCustomPriceModelDelete,Product)),
类型:POST,
dataType:json,
data:addAntiForgeryToken
}
},
架构: {
数据 : 数据,
总计:总计,
型号:{
id:Id,
字段:{
Id:{type:number} ,
CurrencyId : {editable:false,type:number} ,
价格 : {editable:true,type:number} ,
OldPrice : {editable:true,键入:number} ,
ProductCost : {editable:true,type:number} ,
SpecialPrice : {editable:true,type:number} ,
SpecialPriceStartDateTimeUtc : {editable:true,type:date} ,
SpecialPriceEndDateTimeUtc :{editable:true,type:date}
}
}
} ,
错误: function(e){
display_kendoui_grid_error(e );
// 取消更改
this 。 cancelChanges();
} ,
pageSize: 10 ,
serverPaging: true ,
serverFiltering: true ,
serverSorting: true
} ,
pageable: {
刷新 : true,
pageSizes:10
} ,
可滚动 : false,
列: [
{
field:CurrencyId,
title:CurrencyId,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
字段 : Price,
title:Price,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
字段 : OldPrice,
标题: OldPrice,
//整数格式
///格式:{0:0} ,
width : 50
} ,{
字段 : ProductCost,
title:ProductCost,
//整数格式
//格式:{0:0} ,
width : 50
} ,{
field : SpecialPrice,
title:SpecialPrice,
//整数格式
// for mat:{0:0} ,
width : 50
} ,{
field : SpecialPriceStartDateTimeUtc,
title:SpecialPriceStartDateTimeUtc,
type:date,
format:{0:G} ,
width : 50
} ,{
字段 : SpecialPriceEndDateTimeUtc,
title:SpecialPriceEndDateTimeUtc,
类型:date,
格式:{0:G} ,
width : 50
}
,
{命令 : [edit,destroy],标题:& nbsp; , width : 160px}
]
});
});
< / script >
< / td >
< / tr >
< / table >
}
else
{
否 数据
}
@model ProductModel
@if (Model.Id > 0)
{
<table class="adminContent">
<tr>
<td>
<div id="customers-grid"></div>
<script>
$(document).ready(function () {
$("#customers-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("ProductCustomPriceModelList", "Product", new { productId = Model.Id }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
}
,
update: {
url:"@Html.Raw(Url.Action("ProductCustomPriceModelUpdate", "Product"))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
url: "@Html.Raw(Url.Action("ProductCustomPriceModelDelete", "Product"))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
}
},
schema: {
data: "Data",
total: "Total",
model: {
id: "Id",
fields: {
Id: { type: "number" },
CurrencyId: {editable: false, type: "number" },
Price: {editable: true, type: "number" },
OldPrice: {editable: true, type: "number" },
ProductCost: {editable: true, type: "number" },
SpecialPrice: {editable: true, type: "number" },
SpecialPriceStartDateTimeUtc: {editable: true, type: "date" },
SpecialPriceEndDateTimeUtc: {editable: true, type: "date" }
}
}
},
error: function(e) {
display_kendoui_grid_error(e);
// Cancel the changes
this.cancelChanges();
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
pageable: {
refresh: true,
pageSizes: 10
},
scrollable: false,
columns: [
{
field: "CurrencyId",
title: "CurrencyId",
//integer format
//format: "{0:0}",
width: 50
}, {
field: "Price",
title: "Price",
//integer format
//format: "{0:0}",
width: 50
}, {
field: "OldPrice",
title: "OldPrice",
//integer format
///format: "{0:0}",
width: 50
}, {
field: "ProductCost",
title: "ProductCost",
//integer format
// format: "{0:0}",
width: 50
}, {
field: "SpecialPrice",
title: "SpecialPrice",
//integer format
//format: "{0:0}",
width: 50
}, {
field: "SpecialPriceStartDateTimeUtc",
title: "SpecialPriceStartDateTimeUtc",
type: "date",
format: "{0:G}",
width: 50
}, {
field: "SpecialPriceEndDateTimeUtc",
title: "SpecialPriceEndDateTimeUtc",
type: "date",
format: "{0:G}",
width: 50
}
,
{ command: ["edit", "destroy"], title: " ", width: "160px" }
]
});
});
</script>
</td>
</tr>
</table>
}
else
{
No Data
}
解决方案
(document).ready(function () {
("#customers-grid").kendoGrid({ dataSource: { type: "json", transport: { read: { url: "@Html.Raw(Url.Action("ProductCustomPriceModelList", "Product", new { productId = Model.Id }))", type: "POST", dataType: "json", data: addAntiForgeryToken } , update: { url:"@Html.Raw(Url.Action("ProductCustomPriceModelUpdate", "Product"))", type: "POST", dataType: "json", data: addAntiForgeryToken }, destroy: { url: "@Html.Raw(Url.Action("ProductCustomPriceModelDelete", "Product"))", type: "POST", dataType: "json", data: addAntiForgeryToken } }, schema: { data: "Data", total: "Total", model: { id: "Id", fields: { Id: { type: "number" }, CurrencyId: {editable: false, type: "number" }, Price: {editable: true, type: "number" }, OldPrice: {editable: true, type: "number" }, ProductCost: {editable: true, type: "number" }, SpecialPrice: {editable: true, type: "number" }, SpecialPriceStartDateTimeUtc: {editable: true, type: "date" }, SpecialPriceEndDateTimeUtc: {editable: true, type: "date" } } } }, error: function(e) { display_kendoui_grid_error(e); // Cancel the changes this.cancelChanges(); }, pageSize: 10, serverPaging: true, serverFiltering: true, serverSorting: true }, pageable: { refresh: true, pageSizes: 10 }, scrollable: false, columns: [ { field: "CurrencyId", title: "CurrencyId", //integer format //format: "{0:0}", width: 50 }, { field: "Price", title: "Price", //integer format //format: "{0:0}", width: 50 }, { field: "OldPrice", title: "OldPrice", //integer format ///format: "{0:0}", width: 50 }, { field: "ProductCost", title: "ProductCost", //integer format // format: "{0:0}", width: 50 }, { field: "SpecialPrice", title: "SpecialPrice", //integer format //format: "{0:0}", width: 50 }, { field: "SpecialPriceStartDateTimeUtc", title: "SpecialPriceStartDateTimeUtc", type: "date", format: "{0:G}", width: 50 }, { field: "SpecialPriceEndDateTimeUtc", title: "SpecialPriceEndDateTimeUtc", type: "date", format: "{0:G}", width: 50 } , { command: ["edit", "destroy"], title: " ", width: "160px" } ] }); }); </script> </td> </tr> </table> } else { No Data }
这篇关于Kendo UI Inline编辑事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文