How to implement custom fields to display in the gridField?

I want to implement a user-defined feature that allows specific fields to be displayed and the order to be adjusted.

For example, I currently have 5 columns(column 1-5) in readonly grid, and the user can present 3 of them as needed and can adjust the order, e.g. display [column 1, column 5, column 3].

Is there any way to implement this feature? Can you give me some advice?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    I am giving you an example, you can develop like that.

    a!localVariables(
      local!save : 2,
      {
      a!radioButtonField(
        label: "Is user ?",
        choiceLabels: {"User","Admin"},
        choiceValues: {1,2},
        value: local!save,
        saveInto: local!save,
        choiceStyle: "CARDS",
      ),
      a!gridField(
        label: "Read-only Grid",
        labelPosition: "ABOVE",
        data: 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details',
        columns: {
          a!gridColumn(
            label: "Id",
            sortField:  'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{c0258c07-713f-4c0f-8fed-f85fa4aaea65}id',
            value: fv!row[ 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{c0258c07-713f-4c0f-8fed-f85fa4aaea65}id'],
            showWhen: local!save = 2
          ),
          a!gridColumn(
            label: "Name",
            sortField:  'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{a9d0f67a-cba2-4fda-bc8f-3dc112496562}firstName',
            value: fv!row[ 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{a9d0f67a-cba2-4fda-bc8f-3dc112496562}firstName'],
            align: "START"
          ),
        }
      )
      }
    )

Reply
  • 0
    Certified Associate Developer

    I am giving you an example, you can develop like that.

    a!localVariables(
      local!save : 2,
      {
      a!radioButtonField(
        label: "Is user ?",
        choiceLabels: {"User","Admin"},
        choiceValues: {1,2},
        value: local!save,
        saveInto: local!save,
        choiceStyle: "CARDS",
      ),
      a!gridField(
        label: "Read-only Grid",
        labelPosition: "ABOVE",
        data: 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details',
        columns: {
          a!gridColumn(
            label: "Id",
            sortField:  'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{c0258c07-713f-4c0f-8fed-f85fa4aaea65}id',
            value: fv!row[ 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{c0258c07-713f-4c0f-8fed-f85fa4aaea65}id'],
            showWhen: local!save = 2
          ),
          a!gridColumn(
            label: "Name",
            sortField:  'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{a9d0f67a-cba2-4fda-bc8f-3dc112496562}firstName',
            value: fv!row[ 'recordType!{f55afdcb-53bf-4764-9d6b-79d1e1490735}PSB Details.fields.{a9d0f67a-cba2-4fda-bc8f-3dc112496562}firstName'],
            align: "START"
          ),
        }
      )
      }
    )

Children
No Data