Select Rows in a Grid

SAIL Recipes give you an opportunity to explore different interface design patterns. To learn how to directly use SAIL recipes within your interfaces, see Adapt a SAIL Recipe to Work with My Applications.


Display checkboxes on a read-only paging grid to allow users to select multiple rows of data.

This recipe uses an employee data structure and objects created through the Use the Write to Data Store Entity Smart Service Function on an Interface recipe. Make sure that recipes has been built first in order to see data in this recipe.


This scenario demonstrates:

  • How to use grid selection to capture identifying information about the selected row(s)


  /* Set the default paging and sorting config */
  local!gridSelection: a!gridSelection(
    selected: {},
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 10,
      sort: a!sortInfo(
        field: "lastName",
        ascending: true
    local!datasubset: a!queryEntity(
        selection: a!querySelection(columns: {
          a!queryColumn(field: "firstName"),
          a!queryColumn(field: "lastName"),
          a!queryColumn(field: "title")
        pagingInfo: local!gridSelection.pagingInfo
      contents: {
          label: "SAIL Example: Employee Grid Selection",
          totalCount: local!datasubset.totalCount,
          columns: {
            a!gridTextColumn(label: "First", field: "firstName", data: index(local!, "firstName" , {})),
            a!gridTextColumn(label: "Last",  field: "lastName",  data: index(local!, "lastName" , {})),
            a!gridTextColumn(label: "Title", field: "title", data: index(local!, "title" , {}))
          identifiers: local!datasubset.identifiers,
          value: local!gridSelection,
          saveInto: {
          selection: true
          label: "Selected Employee IDs",
          readOnly: true,
          value: if(
            length(local!gridSelection.selected) = 0,
            "No employees selected",
              ", "

Test it out

  1. Select a checkbox and observe the values of the text fields
    • The Selected Employee IDs show the selected row's ID
  2. Select the top checkbox in the column header row
    • The Selected Employee IDs show 10 selected values

Notable implementation details

  • GridSelection must be used when a grid is configured for selection. The value of the grid is gridSelection rather than pagingInfo, and the value that the grid returns when the user interacts with it is also a gridSelection. PagingInfo information is embedded in gridSelection.
  • The values stored in the selected parameter of gridSelection are the identifiers of the datasubset. In this case, it's the primary key value.