This is my setup code for the grid.
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, []);
});
The click
event for addrowbutton
fires proplerly, and the line $("#index-grid").jqxGrid('addrow', id, []);
seems to execute with no error, but no new row is appended to the grid. I seem to be missing a config or line of code somewhere. What could it be?
May be it should be {} instead of [].