...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
isc.RestDataSource.create({
ID: "supplyItem",
fields: [
{ name: "itemID", type: "sequence", hidden: "true", primaryKey: "true" },
{ name: "itemName", type: "text", title: "Item", length: "128", required: "true" },
{ name: "SKU", type: "text", title: "SKU", length: "10", required: "true" },
{ name: "description", type: "text", title: "Description", length: "2000" },
{ name: "category", type: "text", title: "Category", length: "128", required: "true", foreignKey: "supplyCategory.categoryName" },
{ name: "units", type: "enum", title: "Units", length: "5",
valueMap: ["Roll", "Ea", "Pkt", "Set", "Tube", "Pad", "Ream", "Tin", "Bag", "Ctn", "Box"]
},
{ name: "unitCost", type: "float", title: "Unit Cost", required: "true",
validators: [
{ type: "floatRange", min: "0", errorMessage: "Please enter a valid (positive) cost" },
{ type: "floatPrecision", precision: 2, errorMessage: "The maximum allowed precision is 2" }
]
},
{ name: "inStock", type: "boolean", title: "In Stock" },
{ name: "nextShipment", type: "date", title: "Next Shipment" }
],
dataFormat: "json",
criteriaPolicy:"dropOnChange",
operationBindings: [
{ operationType: "fetch", dataProtocol: "postMessage", dataURL: "fetch.php" },
{ operationType: "add", dataProtocol: "postMessage", dataURL: "add.php" },
{ operationType: "update", dataProtocol: "postMessage", dataURL: "update.php" },
{ operationType: "remove", dataProtocol: "postMessage", dataURL: "remove.php" }
]
}); |
...