Appframe Knowledge Base

1 hits

How to define a DataObject which reflects the contents of an Array

// Define the array containing the initial data 
var vArrayOfObjects = [
    { Type: "Issue" },
    { Type: "Suggestion" }

// Define the array data handler that uses the array we just declared
var vArrayDataHandler = new, ["Type"]);

// Define the data object that uses the array data handler we just defined
var vArrayDataObject = new af.DataObject({
    dataHandler: vArrayDataHandler,
    selectFirstRow: false,
    fields: [{ name: "Type", type: "string" }]

// If you want to add items:
vArrayOfObjects.push({ Type: "Secret Type" });

// If you want to remove items:
vArrayOfObjects.splice(0, 1);

// If you want to modify items:
vArrayOfObjects[0] += " Item";

components web · Perma link post comment Posted by: Jan Henrik H. Meling (13-nov-2013)