我真的很努力地使用Controller服務加載jsGrid。我無法做到正確。通過在MVC中調用Controller/WebService加載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" }
]
});
別t忘記使用:autoload:true,如果不是loadData將不會被調用 – mauronet