Skip to main content
July 23, 2023
Question

Editable Grid

  • July 23, 2023
  • 3 replies
  • 0 views

Hi All,

I have a editable grid .when I click on add button  one row created .Now, I want how to show the add button when the user uploaded file in it and if the user not uploaded the file then add button not show for multiple rows?

Thanks

3 replies

stefanhelzle0001
Brainy
July 23, 2023

The dynamic link to add a new row has a showWhen parameter. Add any condition to this to make it visible as needed.

July 24, 2023

You can use showwhen condition in the add row link. You can follow below code snippet.


a!localVariables(
  local!Items,
  local!files,
  {
    a!gridLayout(
      label: "Editable Grid",
      labelPosition: "ABOVE",
      headerCells: {
        a!gridLayoutHeaderCell(label: "Header Cell")
      },
      columnConfigs: {},
      rows: {
        a!gridRowLayout(
          contents: a!fileUploadField(
            label: "File Upload",
            value: local!files,
            saveInto: local!files
          )
        ),
        a!forEach(
          items: local!Items,
          expression: a!gridRowLayout(
            contents: a!fileUploadField(
              label: "File Upload",
              value: local!files,
              saveInto: local!files
            )
          )
        ),
        
      },
      addRowLink: a!dynamicLink(
        label: "Add row",
        value: local!Items,
        saveInto: 
        a!save(
          local!Items,
          append(local!Items,save!value)  
        ),
        showWhen: if(a!isNullOrEmpty(local!files),false(),true())
        
      ),
      selectionSaveInto: {},
      validations: {},
      shadeAlternateRows: true
    )
  }
  
)

July 24, 2023

Use showWhen parameter