Multiple Checkboxes in Editable Grid

Hi,

For my requirement, I'm using Editable Grid it contains multiple check boxes. I'm passing the local variable into the values. But for a single check box selection I am able to save the value, whereas if i'm trying to select multiple check boxes at a time, I am unable to save values. I want to check multiple values ​​and save all of them values.

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi Narmada,

    See the following working code. Specifically note line 60: "value: tostring(fv!item.ManufacturingSteps),"

    When the fv!item.ManufacturingSteps is of Any Type, the checkbox will not remain checked. You will need to make sure your value field's type matches the checkBoxField's choiceValue type. 

    Let me know if that helps! If it doesn't - please provide similar values to your constants to ensure we can replicate your issue. 

     

    load(
      local!data: {},
      local!items: {
        {
          SiteName: "",
          SiteCountry: "",
          ManufacturingSteps: ""
        }
      },
      with(
        /*local!mfgsite: rule!CMP_qryMfgSitedetails(),*/
        /*local!mfgcountry: rule!CMP_qryCountryDetails(*/
          /*countryode: 1*/
        /*),*/
        a!sectionLayout(
          label: "Supply Chain Details",
          /*isCollapsible: "True",*/
          isInitiallyCollapsed: "True",
          divider: "BELOW",
          contents: {
            a!gridLayout(
              label: "Site Information",
              headerCells: {
                a!gridLayoutHeaderCell(
                  label: "Site Name"
                ),
                a!gridLayoutHeaderCell(
                  label: "Site Country"
                ),
                a!gridLayoutHeaderCell(
                  label: "Manufacturing Steps"
                )
              },
              rows: {
                a!forEach(
                  items: local!items,
                  expression: a!gridRowLayout(
                    contents: {
                      a!dropdownField(
                        label: "SiteName" & fv!index,
                        choiceLabels: {"MAN NAME1","MAN NAME2"},
                        choiceValues: {"MAN NAME1","MAN NAME2"},
                        placeholderLabel: "--Select Site--",
                        value: fv!item.SiteName,
                        saveInto: fv!item.SiteName
                      ),
                      a!dropdownField(
                        label: "SiteCountry" & fv!index,
                        choiceLabels: {"COUNTRY NAME1","COUNTRY NAME2"},
                        choiceValues: {"COUNTRY NAME1","COUNTRY NAME2"},
                        placeholderLabel: "--Select Country--",
                        value: fv!item.SiteCountry,
                        saveInto: fv!item.SiteCountry
                      ),
                      a!checkboxField(
                        label: "Manufacturing Steps" & fv!index,
                        choiceLayout: "COMPACT",
                        choiceLabels: {"Y"},
                        choiceValues: {"Y"},
                        value: tostring(fv!item.ManufacturingSteps),
                        saveInto: fv!item.ManufacturingSteps
                      )
                    }
                  )
                )
              },
              addRowLink: a!dynamicLink(
                label: "Add site",
                value: {
                  SiteName: "",
                  SiteCountry: "",
                  ManufacturingSteps: ""
                },
                saveInto: a!save(
                  local!items,
                  append(
                    local!items,
                    save!value
                  )
                )
              ),
              shadeAlternateRows: true
            ),
            a!textField(
              readOnly: true,
              /*value: local!items.ManufacturingSteps*/
              value: typename(typeof(local!items[1].ManufacturingSteps))
            ),
            a!buttonLayout(
              primaryButtons: a!buttonWidgetSubmit(
                label: "Submit",
                style: "PRIMARY",
                confirmHeader: "Warning!",
                confirmMessage: "Steps will be added to the Database.
    Please Click Yes to Proceed",
                saveInto: a!writeToDataStoreEntity()
              )
            )
          }
        )
      )
    )

Reply
  • 0
    Certified Lead Developer

    Hi Narmada,

    See the following working code. Specifically note line 60: "value: tostring(fv!item.ManufacturingSteps),"

    When the fv!item.ManufacturingSteps is of Any Type, the checkbox will not remain checked. You will need to make sure your value field's type matches the checkBoxField's choiceValue type. 

    Let me know if that helps! If it doesn't - please provide similar values to your constants to ensure we can replicate your issue. 

     

    load(
      local!data: {},
      local!items: {
        {
          SiteName: "",
          SiteCountry: "",
          ManufacturingSteps: ""
        }
      },
      with(
        /*local!mfgsite: rule!CMP_qryMfgSitedetails(),*/
        /*local!mfgcountry: rule!CMP_qryCountryDetails(*/
          /*countryode: 1*/
        /*),*/
        a!sectionLayout(
          label: "Supply Chain Details",
          /*isCollapsible: "True",*/
          isInitiallyCollapsed: "True",
          divider: "BELOW",
          contents: {
            a!gridLayout(
              label: "Site Information",
              headerCells: {
                a!gridLayoutHeaderCell(
                  label: "Site Name"
                ),
                a!gridLayoutHeaderCell(
                  label: "Site Country"
                ),
                a!gridLayoutHeaderCell(
                  label: "Manufacturing Steps"
                )
              },
              rows: {
                a!forEach(
                  items: local!items,
                  expression: a!gridRowLayout(
                    contents: {
                      a!dropdownField(
                        label: "SiteName" & fv!index,
                        choiceLabels: {"MAN NAME1","MAN NAME2"},
                        choiceValues: {"MAN NAME1","MAN NAME2"},
                        placeholderLabel: "--Select Site--",
                        value: fv!item.SiteName,
                        saveInto: fv!item.SiteName
                      ),
                      a!dropdownField(
                        label: "SiteCountry" & fv!index,
                        choiceLabels: {"COUNTRY NAME1","COUNTRY NAME2"},
                        choiceValues: {"COUNTRY NAME1","COUNTRY NAME2"},
                        placeholderLabel: "--Select Country--",
                        value: fv!item.SiteCountry,
                        saveInto: fv!item.SiteCountry
                      ),
                      a!checkboxField(
                        label: "Manufacturing Steps" & fv!index,
                        choiceLayout: "COMPACT",
                        choiceLabels: {"Y"},
                        choiceValues: {"Y"},
                        value: tostring(fv!item.ManufacturingSteps),
                        saveInto: fv!item.ManufacturingSteps
                      )
                    }
                  )
                )
              },
              addRowLink: a!dynamicLink(
                label: "Add site",
                value: {
                  SiteName: "",
                  SiteCountry: "",
                  ManufacturingSteps: ""
                },
                saveInto: a!save(
                  local!items,
                  append(
                    local!items,
                    save!value
                  )
                )
              ),
              shadeAlternateRows: true
            ),
            a!textField(
              readOnly: true,
              /*value: local!items.ManufacturingSteps*/
              value: typename(typeof(local!items[1].ManufacturingSteps))
            ),
            a!buttonLayout(
              primaryButtons: a!buttonWidgetSubmit(
                label: "Submit",
                style: "PRIMARY",
                confirmHeader: "Warning!",
                confirmMessage: "Steps will be added to the Database.
    Please Click Yes to Proceed",
                saveInto: a!writeToDataStoreEntity()
              )
            )
          }
        )
      )
    )

Children
No Data