Is it possible to create Grid without With() variable? if yes then how?

Is it possible to create Grid without With() variable? if yes then how?

  Discussion posts and replies are publicly visible

Parents
  • You could re-evaluate your query for the datasubset in the saveInto of the gridField (and anywhere else that should update the data in the grid).  It's a bit more cumbersome, but it will work.

    Re-writing the example from the documentation this way would be:

    =load(
          local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5, sort: a!sortInfo(field: "label", ascending: true)),
          local!sampleData: {
            type!LabelValue(label: "John Smith"),
            type!LabelValue(label: "Michael Johnson"),
            type!LabelValue(label: "Mary Reed"),
            type!LabelValue(label: "Angela Cooper"),
            type!LabelValue(label: "Elizabeth Ward"),
            type!LabelValue(label: "Daniel Lewis"),
            type!LabelValue(label: "Paul Martin"),
            type!LabelValue(label: "Jessica Peterson"),
            type!LabelValue(label: "Mark Hall"),
            type!LabelValue(label: "Rebecca Wood")
          },
          local!datasubset: todatasubset(local!sampleData, local!pagingInfo),
            local!dataForCurrentPage: local!datasubset.data,
            a!gridField(
              label: "Employees",
              instructions: local!pagingInfo,
              totalCount: local!datasubset.totalCount,
              columns: {
                a!gridTextColumn(
                  label: "Name",
                  field: "label",
                  data: index(local!dataForCurrentPage, "label", null),
                  alignment: "LEFT"
                )
              },
              value: local!pagingInfo,
              saveInto: {local!pagingInfo,
              a!save(
                local!datasubset,
                todatasubset(local!sampleData, local!pagingInfo)
              ),
              a!save(
                local!dataForCurrentPage,
                local!datasubset.data
              )
              }
            )
          )

  • 0
    Certified Lead Developer
    in reply to lucasj

    This is along the lines of what I was thinking, but of course it 100% depends on the use case (versus, say, the use case posted below, which would require completely different implementation strategy).  This is why I wanted OP to confirm their use case first, because otherwise all we're doing is throwing guesses into the wind.

Reply Children
No Data