Page tree
Skip to end of metadata
Go to start of metadata

The getRecords() method extracts all records from a grid and returns them as an array.

The array is a copy of the records. Modifying the array does not modify the grid records directly. You may, however, modify the array and then place it back into the grid using the display.grid.replaceRecords() API.

 

Return Value

An array containing the extracted records. Each array element is a JavaScript object with properties for each field in the grid.


Example

pjs.defineDisplay("display.json");  // assume display.json defines mygrid with fields named "product" and "description"

product = 1;
description = "ONE"; 
display.mygrid.write();
 
product = 2;
description = "TWO"; 
display.mygrid.write();
 
console.log(display.mygrid.getRecords());
 
// The line above will log the following output:
// [ { product: 1, description: "ITEM ONE" },
//   { product: 2, description: "ITEM TWO" } ]