Add a Field to a Mobile Form
Mobile Framework
Add a Field to a Mobile Form
Form fields can be added to existing forms by modifying the form JavaScript code.
Steps required to add a field to a form if the field exists in the Web Central database:
- Add the field definition to the form View file
- Add the field to the Model class
- Add the field to the Store class (required for synchronization)
The field will be added to the mobile database when the app is restarted/
See Also
:
Archibus Mobile Framework Fields
Example:
You may wish to add a field to the mobile form. For example, add an Employee Count field to the Room Information form.
Add the field definition for the
count_em
field to the Room Survey View file:
Ext.define('SpaceBook.view.RoomSurvey', {
...
config: {
model: 'SpaceBook.model.RoomSurvey',
storeId: 'roomSurveyStore',
items: [
...
{
xtype: 'fieldset',
title: 'Room Information',
items: [
{
xtype: 'promptfield',
label: 'Room Category',
name: 'rm_cat',
panelName: 'roomSurveyPanel'
},
{
xtype: 'numberfield',
label: 'Employee Count',
name: 'count_em',
panelName: 'roomSurveyPanel'
},
File:
ab-products/common/mobile/src/SpaceBook/app/view/RoomSurvey.js
Add the field definition for the
count_em
field to the Model class:
Ext.define('SpaceBook.model.RoomSurvey', {
extend: 'Common.model.ModelBase',
config: {
fields: [
{ name: 'id', type: 'int' },
...
{ name: 'count_em', type: 'int' },
File : ab-products/common/mobile/src/SpaceBook/app/model/RoomSurvey.js
Next, add the new field to the store class
serverFieldNames
property. By doing this the field will be included in the synchronization:
Ext.define('SpaceBook.store.RoomSurveys', {
...
serverFieldNames: [ 'bl_id', 'fl_id', 'rm_id', 'dv_id', 'dp_id', 'rm_cat', 'rm_type', 'rm_std',
'prorate','status', 'survey_id', 'rm_use', 'name', 'mob_locked_by', 'mob_is_changed',
'transfer_status', 'survey_id', 'count_em'],
File : ab-products/common/mobile/src/SpaceBook/app/store/RoomSurveys.js