disable a column in an editable interface

I want to disable a column for group of users in the editable grid

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Use showWhen parameter in Grid header cell and in gridRowLayout's contents, then add condition a!isUserMemberOfGroup( UserName, {Groups})

    Example:

    a!localVariables(
    local!items: {
    { item: "Item 1", qty: 1, unitPrice: 10 },
    { item: "Item 2", qty: 2, unitPrice: 20 }
    },
    a!gridLayout(
    label: "Products",
    instructions: "Update the item name, quantity, or unit price.",
    headerCells: {
    a!gridLayoutHeaderCell(label: "Item", showWhen:a!isUserMemberOfGroup( UserName, {Groups})),
    a!gridLayoutHeaderCell(label: "Qty"),
    a!gridLayoutHeaderCell(label: "Unit Price"),
    a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
    },
    rows: {
    a!gridRowLayout(
    contents: {
    a!textField(
    value: local!items[1].item,
    saveInto: local!items[1].item,
    showWhen: a!isUserMemberOfGroup( UserName, {Groups})
    ),
    a!integerField(
    value: local!items[1].qty,
    saveInto: local!items[1].qty
    ),
    a!floatingPointField(
    value: local!items[1].unitPrice,
    saveInto: local!items[1].unitPrice
    ),
    a!textField(
    value: a!currency(
    isoCode: "USD",
    value: tointeger(local!items[1].qty) * todecimal(local!items[1].unitPrice)
    ),
    readOnly: true,
    align: "RIGHT"
    )
    }
    ),

    },
    rowHeader: 1
    )
    )

Reply
  • 0
    Certified Senior Developer

    Use showWhen parameter in Grid header cell and in gridRowLayout's contents, then add condition a!isUserMemberOfGroup( UserName, {Groups})

    Example:

    a!localVariables(
    local!items: {
    { item: "Item 1", qty: 1, unitPrice: 10 },
    { item: "Item 2", qty: 2, unitPrice: 20 }
    },
    a!gridLayout(
    label: "Products",
    instructions: "Update the item name, quantity, or unit price.",
    headerCells: {
    a!gridLayoutHeaderCell(label: "Item", showWhen:a!isUserMemberOfGroup( UserName, {Groups})),
    a!gridLayoutHeaderCell(label: "Qty"),
    a!gridLayoutHeaderCell(label: "Unit Price"),
    a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
    },
    rows: {
    a!gridRowLayout(
    contents: {
    a!textField(
    value: local!items[1].item,
    saveInto: local!items[1].item,
    showWhen: a!isUserMemberOfGroup( UserName, {Groups})
    ),
    a!integerField(
    value: local!items[1].qty,
    saveInto: local!items[1].qty
    ),
    a!floatingPointField(
    value: local!items[1].unitPrice,
    saveInto: local!items[1].unitPrice
    ),
    a!textField(
    value: a!currency(
    isoCode: "USD",
    value: tointeger(local!items[1].qty) * todecimal(local!items[1].unitPrice)
    ),
    readOnly: true,
    align: "RIGHT"
    )
    }
    ),

    },
    rowHeader: 1
    )
    )

Children