Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Radio button in Grid

Certified Senior Developer

Hi Everyone,

Is there any way to include radio button instead of check box in read only grid for selection?

  Discussion posts and replies are publicly visible

Parents
  • You can add it in a dedicated column and build custom logic around it so that when you select the radio button, it actually selects the grid row. 

  • But this is only possible in an editable grid. Not read-only grid. 
    You can use an editable one and make it look like read-only if required, but please remember that it will have slower performance than read-only. 

  • Somewhat like this. 

    a!localVariables(
      local!data: {
        { id: 1, name: "HarshitBumb.com" },
        { id: 2, name: "AppianSpace.com" },
        { id: 3, name: "chat.openai.com" }
      },
      local!selectedRow,
      {
        a!gridLayout(
          label: "Editable Grid",
          labelPosition: "ABOVE",
          headerCells: {
            a!gridLayoutHeaderCell(label: ""),
            a!gridLayoutHeaderCell(label: "Resources")
          },
          columnConfigs: {},
          rows: a!forEach(
            items: local!data,
            expression: a!gridRowLayout(
              id: fv!item.id,
              contents: {
                a!radioButtonField(
                  choiceLabels: "",
                  choiceValues: fv!item.id,
                  value: if(
                    tointeger(local!selectedRow) <> tointeger(fv!item.id),
                    null,
                    tointeger(local!selectedRow)
                  ),
                  saveInto: local!selectedRow
                ),
                a!richTextDisplayField(value: fv!item.name)
              }
            )
          ),
          selectionValue: local!selectedRow,
          selectionStyle: "ROW_HIGHLIGHT",
          selectable: true,
          selectionSaveInto: {},
          validations: {},
          shadeAlternateRows: true
        )
      }
    )

  • At this point honestly I'd just consider using a rich text icon in the relevant column, mimicing the appearance of a radio button (i guess "circle-o" and "dot-circle-o" would suffice) where you just control which one is shown by a local variable storing the selection.  One benefit here would be you could (optionally) allow for "de-selecting" the row in question without needing to force selection of a different row (depending on what you actually want it to do, of course).

    That would look something like this:

    a!localVariables(
      local!choices: {
        {label: "asdf"},
        {label: "qwer"},
        {label: "zxcv"}
      },
      
      local!selectedIndex: tointeger(null()),
      
      a!gridField(
        data: local!choices,
        
        columns: {
          a!gridColumn(
            label: "",
            align: "CENTER",
            width: "ICON",
            value: a!richTextDisplayField(
              value: a!richTextItem(
                size: "MEDIUM",
                text: {
                  a!richTextIcon(
                    showWhen: local!selectedIndex <> fv!identifier,
                    icon: "circle-o",
                    link: a!dynamicLink(
                      saveInto: a!save(local!selectedIndex, fv!identifier)
                    ),
                    caption: "Click to Select",
                    linkStyle: "STANDALONE"
                  ),
                  a!richTextIcon(
                    showWhen: local!selectedIndex = fv!identifier,
                    icon: "dot-circle-o",
                    link: a!dynamicLink(
                      saveInto: a!save(local!selectedIndex, tointeger(null()))
                    ),
                    caption: "Click to De-Select",
                    linkStyle: "STANDALONE"
                  )
                }
              )
            )
          ),
          a!gridColumn(
            label: "Value",
            value: fv!row.label
          )
        }
      )
    )

Reply
  • At this point honestly I'd just consider using a rich text icon in the relevant column, mimicing the appearance of a radio button (i guess "circle-o" and "dot-circle-o" would suffice) where you just control which one is shown by a local variable storing the selection.  One benefit here would be you could (optionally) allow for "de-selecting" the row in question without needing to force selection of a different row (depending on what you actually want it to do, of course).

    That would look something like this:

    a!localVariables(
      local!choices: {
        {label: "asdf"},
        {label: "qwer"},
        {label: "zxcv"}
      },
      
      local!selectedIndex: tointeger(null()),
      
      a!gridField(
        data: local!choices,
        
        columns: {
          a!gridColumn(
            label: "",
            align: "CENTER",
            width: "ICON",
            value: a!richTextDisplayField(
              value: a!richTextItem(
                size: "MEDIUM",
                text: {
                  a!richTextIcon(
                    showWhen: local!selectedIndex <> fv!identifier,
                    icon: "circle-o",
                    link: a!dynamicLink(
                      saveInto: a!save(local!selectedIndex, fv!identifier)
                    ),
                    caption: "Click to Select",
                    linkStyle: "STANDALONE"
                  ),
                  a!richTextIcon(
                    showWhen: local!selectedIndex = fv!identifier,
                    icon: "dot-circle-o",
                    link: a!dynamicLink(
                      saveInto: a!save(local!selectedIndex, tointeger(null()))
                    ),
                    caption: "Click to De-Select",
                    linkStyle: "STANDALONE"
                  )
                }
              )
            )
          ),
          a!gridColumn(
            label: "Value",
            value: fv!row.label
          )
        }
      )
    )

Children