這是我的網格設置代碼。爲什麼我的代碼不能將一個新的空白行添加到jqxGrid中?
var source =
{
datatype: "json",
datafields: [
{ name: 'Name', type: 'string' },
{ name: 'PaymentSchemeName', type: 'string' },
{ name: 'IsActive', type: 'boolean' },
{ name: 'Remarks', type: 'string' }
],
url: "@Url.Action("GetParkades")"
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#index-grid").jqxGrid(
{
width: 900,
source: dataAdapter,
editable: true,
columns: [
{ text: "Name", datafield: "Name", cellsformat: 'd', width: 300 },
{ text: "Payment Scheme", datafield: "PaymentSchemeName", width: 200 },
{ text: "Active", datafield: "IsActive", width: 50, columntype: 'checkbox' },
{ text: "Operator Remarks", datafield: "Remarks" }
]
});
$("#addrowbutton").jqxButton({ theme: theme });
$("#addrowbutton").bind('click', function() {
var id = $("#index-grid").jqxGrid('getdatainformation').rowscount;
$("#index-grid").jqxGrid('addrow', id, []);
});
的click
事件addrowbutton
火災proplerly,而行$("#index-grid").jqxGrid('addrow', id, []);
似乎沒有錯誤來執行,但沒有新行追加到網格。我似乎在某處丟失了一個配置或一行代碼。會是什麼呢?
所以應該,謝謝。 – ProfK