var showEmps = function (did) {
$("#myGrid").kendoGrid({
sortable: true,
pageable: true,
scrollable: true,
columnMenu: true,
filterable: {
extra: false
},
dataSource: {
transport: {
read: "/Employee/ShowEmpByDept",
dataType: "json",
parameterMap: function (data1, type) {
var data = {
deptid: did
}
return data;
}
},
schema: {
model: {
fields: {
EmpID: { type: "number" },
JOD: { type: "date" },
LastName: { type: "string" },
Dept: { type: "string" },
}
}
},
pageSize: 15
},
columns: [
{
field: "EmpID",
title: "Emp ID",
filterable: false,
headerTemplate: '<span title="Emp ID">Emp ID</span>'
},
{
field: "JOD",
title: "JOD",
width: 90,
template: '#= kendo.toString(JOD,\"MM/dd/yyyy\") #',
filterable: { extra: true }
},
{
field: "LastName",
title: "Last Name",
},
{
field: "Dept",
title: "Dept",
}
],
}).data("kendoGrid");
};
});
我在文档就绪方法上调用 showEmps 方法,例如 (showEmps(1))
现在,我有一个包含部门列表的下拉列表。
当我更改下拉列表时,我想将部门 ID 传递给 showEmps 方法,以便使用选定的下拉部门刷新我的网格