Article

Sorting in the mobile application

Question

The list of orders is not displayed correctly in the mobile app. How should I set up the application to sort the orders by registration date (the latest added order should be at the top)?

Answer

To sort by a specific column, you need to implement additional logic in the mobile app manifest. For example:

Terrasoft.sdk.GridPage.setOrderByColumns("Order", {
    column: "CreatedOn",
    orderType: Terrasoft.OrderTypes.DESC
});

This happens because there was no default sorting mechanism in this mobile application section. Below is an example:

 

- Add the “UsrTestOrderMobile” object with the required columns

- Register the detail in the detail wizard

- Add detail in the mobile application wizard

- Configure the sorting mechanism. Create a new custom schema, e.g., “UsrMobileUsrTestOrderMobileModuleConfig” with the following code:

Terrasoft.sdk.GridPage.setOrderByColumns("UsrTestOrderMobile", {
    column: "UsrName",
    orderType: Terrasoft.OrderTypes.DESC
});

- Save changes

- Connect it to the manifest in the “Models” section of the required “PagesExtensions” detail object

- clear the cache and re-synchronize (to get the most recent settings)

Important:



- make sure all the necessary columns are synchronized in the import settings (ModelDataImportConfig)



- make sure there was a primary column (which is used for sorting) for display in an object or at the code level (below is an example):

Terrasoft.sdk.GridPage.setPrimaryColumn("UsrTestOrderMobile", "UsrName");
Terrasoft.sdk.RecordPage.addColumn("UsrTestOrderMobile", {
        name: "UsrName",
        position: 1
    }, "primaryColumnSet");

 

Like 0

Like

Share

0 comments
Show all comments