Want to disable button conditionally on addRowlink: a!dynamicLink

Hi All,

I want to disable button if data set contains one row already . I want to restrict to add more then one. If it is more than one then Add button should not allow me to add new row.

 

Please help me on that.

addRowlink: a!dynamicLink(
label: "Sample",
value: 'type!{****'(***,***,***),
saveInto: {a!save(***,append(***))}
),

validations: if(
toInteger(
count(
ri!aData
)
) > "1",
FormAPI.setDisabled("???", ??),
""
)

 

Regards

Saurav

  Discussion posts and replies are publicly visible

Parents
  • You can't show the link as disabled using addRowLink, but you could hide it if there is already an existing row in the table. You could do something like this:


    load(
    local!rows: {},
    a!gridLayout(
    headerCells: {
    a!gridLayoutHeaderCell(label: "label"),
    a!gridLayoutHeaderCell(label: "")
    },
    columnConfigs: {
    a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
    a!gridLayoutColumnConfig(width: "ICON")
    },
    rows: a!forEach(
    local!rows,
    a!gridRowLayout(
    contents: {
    a!textField(value: fv!item.label, saveInto: fv!item.label),
    a!imageField(
    images: a!documentImage(
    document: a!iconIndicator("REMOVE"),
    link: a!dynamicLink(
    value: fv!index,
    saveInto: a!save(local!rows, remove(local!rows, save!value))
    )
    )
    )
    }
    )
    ),
    addRowLink: if(count(local!rows) > 0, null,
    a!dynamicLink(
    label: "Add New Row",
    value: {label: null},
    saveInto: a!save(local!rows, append(local!rows, save!value))
    )
    )
    )
    )
Reply
  • You can't show the link as disabled using addRowLink, but you could hide it if there is already an existing row in the table. You could do something like this:


    load(
    local!rows: {},
    a!gridLayout(
    headerCells: {
    a!gridLayoutHeaderCell(label: "label"),
    a!gridLayoutHeaderCell(label: "")
    },
    columnConfigs: {
    a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
    a!gridLayoutColumnConfig(width: "ICON")
    },
    rows: a!forEach(
    local!rows,
    a!gridRowLayout(
    contents: {
    a!textField(value: fv!item.label, saveInto: fv!item.label),
    a!imageField(
    images: a!documentImage(
    document: a!iconIndicator("REMOVE"),
    link: a!dynamicLink(
    value: fv!index,
    saveInto: a!save(local!rows, remove(local!rows, save!value))
    )
    )
    )
    }
    )
    ),
    addRowLink: if(count(local!rows) > 0, null,
    a!dynamicLink(
    label: "Add New Row",
    value: {label: null},
    saveInto: a!save(local!rows, append(local!rows, save!value))
    )
    )
    )
    )
Children
No Data