Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejavascript
titleemployees.js
isc.RestDataSource.create({
    "ID": "employees",
    "fields": [
        {"name": "Name", "title": "Name", "type": "text", "length": "128" },
        {"name": "EmployeeId", "title": "Employee ID", "type": "integer", "primaryKey": "true", "required": "true" },
        {"name": "ReportsTo", "title": "Manager", "type": "integer", "required": "true", "foreignKey": "employees.EmployeeId", "rootValue": "1", "detail": "true" },
        { name": "Job", "title": "Title", "type": "text", "length": "128" },
        { "name": "Email", "title": "Email", "type": "text", "length": "128" },
        { "name": "EmployeeType", "title": "Employee Type","type": "text", "length": "40" },
        { "name": "EmployeeStatus", "title": "Status", "type": "text", "length": "40" },
        { "name": "Salary", "title": "Salary", "type": "float" },
        { "name": "OrgUnit", "title": "Org Unit", "type":"text", "length":"128" },
        { "name": "Gender", "title": "Gender", "type":"text", "length":"7",
            "valueMap": ["male", "female"]
        },
        { "name": "MaritalStatus", "title": "Marital Status", "type": "text", "length": "10",
            "valueMap": ["married", "single"]
        }
    ],
    "dataFormat": "json",    
    "operationBindings": [
            { operationType"operationtype": "fetch", "dataProtocol": "postMessage", "dataURL": "process.php" },
            { operationType"operationtype": "add", "dataProtocol": "postMessage", "dataURL": "process.php" },
            { operationType"operationtype": "update", "dataProtocol": "postMessage", "dataURL": "process.php" },
            { operationType"operationtype": "remove", "dataProtocol": "postMessage", "dataURL": "process.php" }
        ]
});

 

Create the database table for this DataSource. For this, open the Database Explorer, select the connection to the database and right click 'Tables'. In the popup menu select 'Add new table'. Using the table editor, enter the fields for the table as follows:

...

 

Code Block
languagejavascript
titleui.js
isc.HStack.create({
    "membersMargin": 10,
    "ID": "gridButtons",
    "members": [
        isc.DynamicForm.create({
            "values": { dataSource: "Change DataSource" },
            "items": [
                { "name": "dataSource", showTitleshow"title": false, editorType"editortype": "select",
                    "valueMap": ["supplyItem", "employees"],
                    "change": function (form, item, value, oldValue) {
                        if (!this.valueMap.contains(value)) return false;
                        else {
                            supplyItemGrid.setDataSource(value);
                            advancedFilter.setDataSource(value);
                            supplyItemGrid.filterData(advancedFilter.getCriteria());
                        }
                    }
                }
            ]
        }),
        isc.IButton.create({
            "top": 250,
            "title": "Edit New",
            "click": "supplyItemGrid.startEditingNew()"
        }),
 
        isc.IButton.create({
            "top": 250,
            "left": 100,
            "title": "Save all",
            "click": "supplyItemGrid.saveAllEdits()"
        }),
    ]
});

 

...