fv!selectedRows in a gridLayout

Hi,

Well I have and editable grindLayout and I'm trying to add to a grindField the selected rows, but in editable grid we can't use fv!rowselected.

How can I do it?

Here's my code.

a!localVariables(
  local!items: {
    {item: "Juan", Apellido: "Muñoz", Provincia: "Madrid", Tlf: 678299336},
    {item: "Jose", Apellido: "Perez", Provincia: "Alicante", Tlf: 999888777},
    {item: "Pepito", Apellido: "Grillo", Provincia: "Sevilla", Tlf: 999888333},
    {item: "Rodolfo", Apellido: "Chiquilicuatre", Provincia: "Granada", Tlf: 333444555},
    {item: "Alfonso", Apellido: "Muñoz", Provincia: "Madrid", Tlf: 678299336},
    {item: "Juan", Apellido: "Perez", Provincia: "Alicante", Tlf: 999888777},
    {item: "Jose", Apellido: "Grillo", Provincia: "Sevilla", Tlf: 999888333},
    {item: "Pepito", Apellido: "Chiquilicuatre", Provincia: "Granada", Tlf: 333444555},
    {item: "Rodolfo", Apellido: "Muñoz", Provincia: "Madrid", Tlf: 678299336},
    {item: "Alfonso", Apellido: "Perez", Provincia: "Alicante", Tlf: 999888777},
    {item: "Juan", Apellido: "Grillo", Provincia: "Sevilla", Tlf: 999888333},
    {item: "Jose", Apellido: "Chiquilicuatre", Provincia: "Granada", Tlf: 333444555},
    {item: "Pepito", Apellido: "Muñoz", Provincia: "Madrid", Tlf: 678299336},
    {item: "Rodolfo", Apellido: "Perez", Provincia: "Alicante", Tlf: 999888777},
    {item: "Alfonso", Apellido: "Grillo", Provincia: "Sevilla", Tlf: 999888333},
  },
  local!selected: tointeger({}),
  local!selectedPersonas,
  local!pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 5,
  ),
  with(local!datasubset: todatasubset(
    local!items,
    local!pagingInfo
  ),
  local!dataForCurrentPage: local!datasubset.items,
    {
  
  
  
  
  a!gridLayout(
    label: "Nombres",
    instructions: "Seleccionados: " & local!selected & local!selectedPersonas,
    headerCells: {
      a!gridLayoutHeaderCell(label: "Nombre"),
      a!gridLayoutHeaderCell(label: "Apellido", align: "RIGHT"),
      a!gridLayoutHeaderCell(label: "Provincia", align: "RIGHT"),
      a!gridLayoutHeaderCell(label: "Telefono", align: "RIGHT")
    },
    rows: a!forEach(
      items: local!datasubset.data,
      expression: a!gridRowLayout(
        id: fv!index,
        contents: {
          a!textField(
            value: fv!item.item,
            saveInto: ri!persona.nombre 
          ),
          a!textField(
            value: fv!item.Apellido,
            saveInto: ri!persona.apellido,
            align: "RIGHT"
          ),
          a!textField(
            value: fv!item.Provincia,
            saveInto: ri!persona.provincia,
            align: "RIGHT"
          ),
          a!integerField(
            value: fv!item.Tlf,
            saveInto: ri!persona.telefono,
            align: "RIGHT"
          )
        }
      )  
    ),
    selectionValue: local!selected,
    /* Flatten the selected values so the result is easier to work with */
    /* when the select/deselect all option is used in an editable grid  */
    selectionSaveInto: {a!save(local!selected, a!flatten(save!value)),
    a!save(local!selectedPersonas, fv!selectedRows)},
    selectable: true,
    rowHeader: 1
  ),
  
  a!gridField(
    label: "Seleccionados",
    
    
  ),
  
  a!richTextDisplayField(
    value: {
      a!richTextIcon(
        icon: "chevron-left",
        link: a!dynamicLink(
          saveInto: a!save(
            local!pagingInfo,
            a!pagingInfo(
              startIndex: local!pagingInfo.startIndex - local!pagingInfo.batchSize,
              batchSize: local!pagingInfo.batchSize,
            )
          ),
          showWhen: local!pagingInfo.startIndex > 1
        ),
        linkStyle: "STANDALONE"
      ),
      a!richTextItem(
        text: {
          char(
            32
          ),
          a!richTextItem(
            text: {
              joinarray(
                {
                  property(
                    local!pagingInfo,
                    "startIndex"
                  ),
                  char(
                    45
                  ),
                  property(
                    local!pagingInfo,
                    "startIndex"
                  ) + property(
                    local!pagingInfo,
                    "batchSize"
                  ) - 1
                },
                char(
                  32
                )
              )
            },
            style: "STRONG"
          ),
          char(
            32
          ),
          joinarray(
            {
              "of",
              count(
                local!items
              )
            },
            char(
              32
            )
          ),
          char(
            32
          )
        }
      ),
      a!richTextIcon(
        icon: "chevron-right",
        link: a!dynamicLink(
          saveInto: a!save(
            local!pagingInfo,
            a!pagingInfo(
              startIndex: local!pagingInfo.startIndex + local!pagingInfo.batchSize,
              batchSize: local!pagingInfo.batchSize,
            )
          ),
          showWhen: local!pagingInfo.startIndex < count(
            local!items
          ) - local!pagingInfo.batchSize
        ),
        linkStyle: "STANDALONE"
      )
    },
    align: "RIGHT"
  ),
  
  
  
  }
  
),


)

Thank you

  Discussion posts and replies are publicly visible

Parents Reply Children