The list element works differently depending on what else has been added to the screen:
On mobile devices, it is quite often the case that the device does not have good enough performance to show all items in a list at once. To improve this situation the platforms came up with a concept called virtualization. When you scroll down items are added to the bottom of the screen and existing item no longer on the screen are removed from the top.
list CcCaseContactList for CcCaseContact { label = "Case Contacts"; card CcCaseContactCard; }
When a details page is provided for a list the user is presented with a create button. This button allows them to go to the details page with a new record prepared. Sometimes it is instead desirable to send the user to an assistant. This can be done using a custom create command:
[ListName]_Create
containing the command to run when the create button is clicked. For example: CcCaseContactList_Create
. The _Create
postfix is mandatory to replace the built in create functionality.Global
list WorkOrderList for WorkOrders { card WorkOrderCard; command WorkOrderList_Create; } command WorkOrderList_Create { mode = Global; execute { // Executions } }
When using the list on a page, a details property is used to define the page that the app should navigate to when a list item is clicked – this can be seen in the Details Page example metadata earlier. More advanced click actions, for example opening a dialog or navigating to one of several pages depending on a condition, can be be defined instead as follows:
[CardName]_Details
containing the action to be run for each item click. For example, for the metadata example, the command would be called CcCaseContactCard_Details
. The _Details
postfix is mandatory to mark this command as the new click action.By default, if a list is derived from an entity set, it will display the count of items when in the collapsed state. However, in the case of a list that is derived from a function, this is not done automatically for performance reasons. In such case, you may use the count
keyword to indicate a function that will return the numeric count to be displayed. This can be set when defining the list at the root-level and within a page. The function that is defined in page-level will take precedence over the root-level function. It is possible to pass in attribute names as parameters to this function for which the values will be fetched from the current record.
// root-level definition list CustomersListFunction for Customers { card CustomerCard; count = FnGetCustomersCount; } // page-level definition page CustomersPage using Customers { list CustomerList { details = CustomerDetail(CustomerNo); count = FnGetCustomersCount2(CompanyId); } }
An attachments button can be added to list items. This will show a paperclip button under the list item allowing the user to go directly to the attachments screen. For performance reasons the button does not show a count for the number of currently attached files.
list CustomersList for Customers { card CustomerCard; attachments { enabled = [true]; } }