Skip to main content
Known Participant
Jul 23, 2023 5:40 PM UTC
Question

Editable Grid

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
Jul 23, 2023 6:10 PM UTC

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

New Participant
Jul 24, 2023 7:53 AM UTC

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
    )
  }
  
)

Inspiring
Jul 24, 2023 9:25 PM UTC

Use showWhen parameter