Mobile Framework

Add a Download Validating Values Action to a Mobile Form

Validating tables are read-only tables that contain data for tables such as buildings, floors, rooms, division and department.

The Validating data download process is initiated by the Common.sync.Manager.downloadValidatingTables function.

Steps required to add a Validating table action:

  • Create the Model class by extending the Common.data.Model class
  • Create the Store class by extending the Common.store.sync.ValidatingTableStore class
  • Register the Store

Example

Add the Equipment Standard table as a validating table to the Maintenance app. For example, you may wish to include the Equipment Standard Description in the Update Work Request form so that a mobile user can read the description and more easily identify the piece of equipment in question. To add the description, you will need to validate against the Equipment Standard.

Create the Model class.

  1. In the ab-products/common/mobile/src/Common/model folder, create a new js file titled EquipmentStandard.js.
  2. Define a new Common.model.EquipmentStandard class and extend the Common.data.Model class. By placing the new class in the Common namespace, it will be shared by all applications.
  3. Provide field definitions for the validating table fields. The 'id' field is an auto-incremented number used by the mobile database to uniquely identify each record. Specify the eqstd fields to be included in the validating table, 'eq_std' and 'description'.

Ext.define('Common.model.EquipmentStandard', {
extend : 'Common.data.Model',

config : {
fields : [
{ name : 'id', type : 'int' },
{ name : 'eq_std', type : 'string' },
{ name : 'description', type : 'string' }
]
}
});

Create the Store class.

  1. In the ab-products/common/mobile/src/Common/store folder, create a new js file titled EquipmentStandards.js.
  2. Extend the Common.store.sync.ValidatingTableStore class. This class provides all of the functionality needed to create a validating table.
  3. Reference the new Common.model.EquipmentStandard model class in the 'requires' property and the 'model' property of the config parameters
  4. Specify the eqstd table as the serverTableName , indicating the validating table to sync with, and list the fields, eq_std and description .
  5. Use the config parameters to define other properties such as sort field. Assign a unique storeId value to the Store.

Ext.define('Common.store.EquipmentStandards', {
extend : 'Common.store.sync.ValidatingTableStore',
requires : [ 'Common.model.EquipmentStandard' ],
serverTableName : 'eqstd',
serverFieldNames : [ 'eq_std', 'description' ],
inventoryKeyNames : [ 'eq_std' ],

config : {
model : 'Common.model.EquipmentStandard',
storeId : 'equipmentStandardsStore',
remoteSort : true,
remoteFilter : true,
sorters : [ {
property : 'eq_std',
direction : 'ASC'
} ],
enableAutoLoad : true,
proxy : {
type : 'Sqlite'
}
}
});

Register the Store

  1. To register the new Store with the Maintenance app, open the ab-products/common/mobile/src/Maintenance/app.js file.
  2. Add the new Common.store.EquipmentStandards Store to the list of Stores used by the app.

The validating tables are downloaded when the Get Background Data action is selected in the mobile view.