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
    A Score Level 1
    in reply to lucasj

    thanks Lucas, yes, this is what i was looking for. It worked

Reply Children
No Data