我真的很难使用控制器服务加载 jsGrid。我无法正确地做到这一点。
我什至尝试了来自 jsGrid 站点演示的示例代码,但这也不起作用,要么在 !this.data.length 处引发错误,要么根本不加载网格。
每次尝试使用以下代码时,我都没有得到任何数据。
感谢是否有人可以提供帮助。
这是加载 jsGrid 的方式:
$(element).jsGrid({
height: 300,
width: "100%",
filtering: true,
sorting: true,
paging: true,
autoload: true,
pageLoading: true,
controller: {
loadData: function (filter) {
$.ajax({
type: "GET",
url: "../Common/GetData",
data: filter,
dataType: "JSON"
});
}
},
pageSize: 10,
pageButtonCount: 5,
pageIndex: 1,
noDataContent: "No Record Found",
loadIndication: true,
loadIndicationDelay: 500,
loadMessage: "Please, wait...",
loadShading: true,
fields: [
{ name: "Name", type: "textarea", width: 150 },
{ name: "Age", type: "number", width: 50 },
{ name: "Address", type: "text", width: 200 },
{ name: "Country", type: "select" },
{
name: "", type: "text", width: 50, sorting: false, filtering: false,
itemTemplate: function (value) {
return '<div class="edit-container"><a class="edit-custom-field-link">Edit</a><div class="sort-icon-container"><div class="up-arrow-icon"></div><div class="down-arrow-icon"></div></div></div>';
}
}
//{ name: "Married", type: "checkbox", title: "Is Married", sorting: false }
//,{ type: "control" }
]
});