Article

Mobile app. How to add the "Add" button to the lookup field which does not have its own section

Question

Mobile app. How to add the "Add" button to the lookup field which does not have its own section?

Answer

According to the base logic of the mobile application, you can only add new values in the lookup fields only if there is a section for this field with an edit page (for example, the “Owner” field and the “Contacts” section). In order to implement the "Add" button, you need to add a separate edit page and all necessary columns.

To do this:

Create a page schema with an Edit type for the Usrnomberoflid object (for example, the name of the UsrnomberoflidEditPage schema (page)). Quick page code generation mechanisms are described in the "How to quickly generate a page code for the mobile application" article:

Terrasoft.LastLoadedPageData = {
    controllerName: "Terrasoft.configuration.UsrnomberoflidEditPageController",
    viewXClass: "Terrasoft.configuration.UsrnomberoflidEditPageView"
};
 
Ext.define("Terrasoft.configuration.view.UsrnomberoflidEditPage", {
    extend: "Terrasoft.view.BaseEditPage",
    alternateClassName: "Terrasoft.configuration.UsrnomberoflidEditPageView",
    config: {
        id: "UsrnomberoflidEditPage"
    }
});
 
Ext.define("Terrasoft.configuration.controller.UsrnomberoflidEditPage", {
    extend: "Terrasoft.controller.BaseEditPage",
    alternateClassName: "Terrasoft.configuration.UsrnomberoflidEditPageController",
    statics: {
        Model: Usrnomberoflid
    },
    config: {
        refs: {
            view: "#UsrnomberoflidEditPage"
        }
    }
});

Create a schema and register the columns that we want to display on the page (for example, the name of the UsrMobileUsrnomberoflidModuleConfig schema (setting up columns in a new page)):

Terrasoft.sdk.GridPage.setPrimaryColumn("Usrnomberoflid", "Name");
Terrasoft.sdk.RecordPage.addColumnSet("Usrnomberoflid", 
    {
        name: "primaryColumnSet",
        isPrimary: true
    }, 
    [
        {
            name: "Name"
        }
    ]);
Terrasoft.sdk.RecordPage.addColumn("Usrnomberoflid", {
    name: "CreatedOn"
}, "primaryColumnSet");

Connect these schemas to the manifest. For example, "UsrMobileApplicationManifestOpportunities":

"Usrnomberoflid": {
    "Edit": "UsrnomberoflidEditPage",
    "RequiredModels": [
        "Usrnomberoflid"
    ],
    "PagesExtensions": [
        "UsrMobileUsrnomberoflidModuleConfig"
    ]
},

Now if you click on a record, all its information will be displayed; if you swipe across the field from right to left, you will see a list of available values with a quick filter.

Like 0

Like

Share

0 comments
Show all comments