クライアントがインライン編集とフィルタリングを希望しているので、MVCプロジェクトでjsGridを使用しようとしています。 しかし、JSONソースをテーブルに読み込むことができません。 テーブルをロードするための私のjsがそうのようになります。jsGridはJSONデータをレンダリングしません
$("#jsGrid").jsGrid({
height: "50%",
width: "100%",
filtering: true,
inserting: true,
editing: true,
sorting: true,
paging: true,
autoload: true,
pageSize: 10,
pageButtonCount: 5,
deleteConfirm: "Do you really want to delete client?",
controller: {
loadData: function (filter) {
return $.ajax({
type: "GET",
url: "RICInstrumentCode/GetData",
data: filter,
dataType: "json"
});
},
insertItem: function (item) {
return $.ajax({
type: "CREATE",
url: "/api/RICInsrumentCodeTable",
data: item,
dataType: "json"
});
},
updateItem: function (item) {
return $.ajax({
type: "UPDATE",
url: "/api/RICInsrumentCodeTable/" + item.ID,
data: item,
dataType: "json"
});
},
deleteItem: $.noop
//deleteItem: function (item) {
// return $.ajax({
// type: "DELETE",
// url: "/api/data/" + item.ID,
// dataType: "json"
// });
//}
},
fields: [
{ name: "Code", type: "text", title: "RIC Instrument Code", width: 150 },
{ name: "Descr", type: "text", title:"RIC Instrument Code Description", width: 200 },
{ name: "RICInstrumentGroupId", type: "select", title: "RIC Instrument Group", items: countries, valueField: "Id", textField: "Name" },
{ name: "Active", type: "checkbox", title: "Is Active", sorting: true },
{ type: "control" }
]
});
});
loaddataのは、私が働いていたものです。
とJSONのインクルードがGETデータから返されるが、そうのようになります。
[{"Id":1,"Code":"test1","Descr":"first code test","RICInstrumentGroupId":2,"Active":true},{"Id":2,"Code":"APP","Descr":"Apples and bananas","RICInstrumentGroupId":4,"Active":true},{"Id":3,"Code":"1","Descr":"1","RICInstrumentGroupId":1,"Active":true},{"Id":4,"Code":"3","Descr":"3","RICInstrumentGroupId":3,"Active":false}]
これまでのところ、私はアヤックスが発射されていることを確認している、コールのそれと一致するように、私の配列のタイトルを変更し、リターンを確保有効なJSON内にある場合、他に何ができますか?
私の人生にとっては、なぜこれが機能していないのか分かりません。 ご協力いただければ幸いです。 ありがとうございました Jaidon Rymer
どのコンソールエラー? – madalinivascu
全くありません。修正するのが難しいのはどちらですか? – jjr2000
はajaxトリガーですか? – madalinivascu