Editable Grid

Certified Associate Developer

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

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

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

Reply
  • 0
    Certified Associate Developer

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

Children
No Data