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

The shift() method removes the first record in the grid and returns that record as a JavaScript object.

 

Return Value

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"
  
display.mygrid.addRecords([
  { product: 1, description: "ITEM ONE" },
  { product: 2, description: "ITEM TWO" },
  { product: 3, description: "ITEM THREE" }
]);
 
display.mygrid.shift();
  
console.log(display.mygrid.getRecords());
  
// The line above will log the following output:
// [ { product: 2, description: "ITEM TWO" },
//   { product: 3, description: "ITEM THREE" } ]