|
<body>
.. .
<script type="text/javascript">
function myFunction() {
var gridObj = $("#Grid").data("ejGrid");
gridObj.addRecord({ "Name": "NewName", "City": "Newcity" });
};
$(function () {
$("#Grid").ejGrid({
dataSource: shipDetails,
editSettings: { allowAdding: true },
columns: [
. . .
]
});
});
</script>
</body> |
|
[Grid]
$("#Grid").ejGrid({
.. .
editSettings: { allowAdding: true, rowPosition:"bottom" },
. . .
actionComplete: "complete",
});
function complete(args) {
if (args.requestType == "save") {
this.model.dataSource.shift();// Remove the newly added record from first position
this.model.dataSource.push(args.data)// Push the newly added record in data source
this.refreshContent();
}
} |