Select only one choice in grid selection

Hello,

I'd like to be able to select only one choice in a grid selection at the same time.
Is there a way to force that?

OriginalPostID-202357

OriginalPostID-202357

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    over 5 years ago

    I find the official appian SAIL recipe approach of throwing a validation error to be unnecessary and kinda clunky, no offense, and to be quite honest it doesn't make much sense to me that after all this time they've never engineered the paging grid component to contain a "singleSelect" parameter (or alternatively "maxSelections" for greater flexibility) where the "select all" control will be hidden when # of selections is restricted (or at least, smaller than the current page size).

    Out of necessity I've developed the following code which handles the single-select use case pretty strongly IMHO, and it has been refined quite a bit over the past 3 years or so:

    saveInto: {
      a!save(
        local!gridSelection,
        a!gridSelection(
          pagingInfo: save!value.pagingInfo,
          selected: index(
            save!value.selected,
            length(save!value.selected),
            {}
          )
        )
      )
    }

    This code does similar to what some of the prior examples here suggest, though a bit more compact, and automatically handles the use case of de-selecting the current selected item.  Note that there's currently no way to avoid the behavior where clicking the "select all" control causes the last item on the current page to be selected, as mentioned above - this is probably the single strongest reason there really needs to be an OOB control for restricting the number of selections.

Reply
  • 0
    Certified Lead Developer
    over 5 years ago

    I find the official appian SAIL recipe approach of throwing a validation error to be unnecessary and kinda clunky, no offense, and to be quite honest it doesn't make much sense to me that after all this time they've never engineered the paging grid component to contain a "singleSelect" parameter (or alternatively "maxSelections" for greater flexibility) where the "select all" control will be hidden when # of selections is restricted (or at least, smaller than the current page size).

    Out of necessity I've developed the following code which handles the single-select use case pretty strongly IMHO, and it has been refined quite a bit over the past 3 years or so:

    saveInto: {
      a!save(
        local!gridSelection,
        a!gridSelection(
          pagingInfo: save!value.pagingInfo,
          selected: index(
            save!value.selected,
            length(save!value.selected),
            {}
          )
        )
      )
    }

    This code does similar to what some of the prior examples here suggest, though a bit more compact, and automatically handles the use case of de-selecting the current selected item.  Note that there's currently no way to avoid the behavior where clicking the "select all" control causes the last item on the current page to be selected, as mentioned above - this is probably the single strongest reason there really needs to be an OOB control for restricting the number of selections.

Children