首页 > 代码库 > KendoUI Row绑定下拉菜单
KendoUI Row绑定下拉菜单
$("#SalleGrid").kendoGrid({ dataSource: { transport: { read: { dateType: ‘application/json‘, url: ‘/SalesTicket/Single/GG‘, type: ‘POST‘, }, }, schema: { model: { id: "ID", fields: { ID: { editable: false, nullable: true,}, Name: { defaultValue: { TouristTypeID: 4, TouristName: "Beverages" } } } } }, batch: true, pageSize: 15, }, height: 200, selectable: "multiple", sortable: true, columns: [ { field: "ID", title: "ID", hidden: true }, { title: ‘门票代码‘, field: ‘TicketCode‘, editor: categoryDropDownEditor, template: "#=Name.TouristName#" }, ], editable:true, });
function categoryDropDownEditor(container, options) {
$(‘<input required name="‘ + options.field + ‘"/>‘)
.appendTo(container)
.kendoDropDownList({
autoBind: false,
dataTextField: "TouristName",
dataValueField: "TouristTypeID",
dataSource: {
transport: {
read: {
dataType: "json",
url: "/SalesTicket/Single/GetSelectList",
}
}
}
}); }
Grid后台:
[HandlerAjaxOnly] public ActionResult GG() { IQueryable<TouristTypeEntity> tourist = touristtypeApp.GetTouristTypeData(); var result = from x in tourist select new { ID = x.TouristTypeID, Name = new { TouristTypeID = x.TouristTypeID, TouristName = x.Name } }; return Json(result); }
DropDownList:
public ActionResult GetSelectList() { IQueryable<TouristTypeEntity> tourist = touristtypeApp.GetTouristTypeData(); var result = from x in tourist select new { TouristTypeID = x.TouristTypeID, TouristName = x.Name }; return Json(result.ToList(),JsonRequestBehavior.AllowGet); }
KendoUI Row绑定下拉菜单
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。