Article

How to add a button on the edit page in a mobile application

Question

I need to place a button under or next to one of the fields on the edit page, clicking on which will display the lookup list.

I need to open a lookup that is not related to the page, and I may need additional operations before that. This cannot be done by just adding a lookup field.

Is it possible to place a button somewhere in the middle of the page? The manual action will be quite inconvenient for the user.

Answer

In the config view, define the required control + a method to display it, and in the controller, assign a handler:

Ext.define("...view...", {
    config: {
       refreshButton: {
            id: 'usr_order_refresh_btn',
            cls: "x-button-primary-blue",
            text: 'Update'
        }
    },
    showRefreshButton: function (isShow) {
        var navigationPanel = this.getNavigationPanel(); /*a component in which the controll will be displayed*/
        var refreshButton = this.getRefreshButton();
        if (isShow) {
            this._refreshButton = navigationPanel.addButton(refreshButton);
        } else {
            navigationPanel.removeButton(refreshButton);
        }
        return this._refreshButton;
    }
});
Ext.define("...controller...", {
    initializeView: function (view) {
        this.callParent(arguments);
        var btn = view.showRefreshButton(true);
        btn.on("tap", this.onRefreshButtonTap, this);
    },
    onRefreshButtonTap: function() {
        /* subject */
    }
});

If you need to open a picker to select a value, then look in the MobileActivityGridPageControllerV2.  For example, there are pickers that enable you to select the "Responsible" employee (the "getEmployeePicker()" method) or select the schedule mode (the "getGridModePicker()" method).

Like 0

Like

Share

5 comments

Hi,

I am given with the requirement to create a button in Account Edit page section in Mobile application. The above code seems difficult to understand. Can you please explain How create/add a button in mobile application.

Please help/guide me to acheive this.

Sriraksha KS,

Hello, to add the button to the edit page you can follow the instructions from the article: 

https://community.bpmonline.com/articles/adding-custom-user-action-mobi…



Best regards,

Alex

Alex_Tim,

The link you gave displays

"You are not authorized to access this page."

 

Please help !!

Sriraksha KS,

It looks fine from my side. I recommend opening this link in another browser or incognito mode.

Seems like when you are logged into community, the link is not working; i was not logged in and it opened for me; but once i logged into my community profile, the link didn't open.

Show all comments