display.grid.delete()



The delete() method removes a record from the grid either by index or relative record number.



Parameter

  1. Index (optional) - Zero-based index of the record to delete. If omitted and a relative record number field is associated with the grid, then the relative record number is used. Unlike an index, where the first record is identified by 0, a relative record number is 1-based; therefore, the first record is identified by relative record number 1.



Example

pjs.defineDisplay("display.json"); // assume display.json defines mygrid with fields named "product" and "description" display.mygrid.addRecords([ { product: 1, description: "ITEM ONE" }, { product: 2, description: "ITEM TWO" }, { product: 3, description: "ITEM THREE" } ]); display.mygrid.delete(0); console.log(display.mygrid.getRecords()); // The line above will log the following output: // [ { product: 2, description: "ITEM TWO" }, // { product: 3, description: "ITEM THREE" } ]