这是我的网格设置代码。
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
触发,并且该行似乎$("#index-grid").jqxGrid('addrow', id, []);
没有错误地执行,但没有新行附加到网格。我似乎在某处缺少配置或代码行。会是什么呢?