How to fetch only 10 rows per page?

In an interface we are showing grid with 4 columns and data is populated in it through query entity. So in query entity we are fetching all rows matching the search criteria with "local!paginginfo: a!pagingInfo(startIndex:1, batchSize: -1)". We are storing this query entity output in a cdt and using "ri!cdt.column name" to populate data in grid. But In Grid if we use "local!paginginfo: a!pagingInfo(startIndex:1, batchSize: 10)", to show 10 records per page, it is not returning data at all and if use "local!paginginfo: a!pagingInfo(startIndex:1, batchSize: length(ri!cdt.id))", it is returning all rows at a time. Please suggest how to fetch only 10 rows per page

OriginalPostID-200029

OriginalPostID-200029

  Discussion posts and replies are publicly visible

Parents
  • @divyav If you want to avoid querying the entity for the entire data in a single shot, you may do as follows:

    load(
    \tlocal!pagingInfo:a!pagingInfo(startIndex:1,batchSize: 10),
    \tlocal!datasubset:a!queryEntity(query:a!query(pagingInfo:local!pagingInfo)),
    \ta!gridField(
    \ ttotalCount: local!datasubset.totalCount,
    \ tcolumns: {
    \ ta!gridTextColumn(
    \ t label: "",
    \ t data: index(local!datasubset.data,"",{}),
    \ t alignment: "LEFT"
    \ t),
    \ t
    \ t},
    \ tvalue: local!pagingInfo,
    \ tsaveInto: {
    \ tlocal!pagingInfo,
    \ ta!save(local!datasubset,a!queryEntity(query:a!query(pagingInfo:local!pagingInfo)))
    \ t}
    \t)
    )

    This way, you can make a query and refresh the datasubset only when you interact with the grid in the interface.
Reply
  • @divyav If you want to avoid querying the entity for the entire data in a single shot, you may do as follows:

    load(
    \tlocal!pagingInfo:a!pagingInfo(startIndex:1,batchSize: 10),
    \tlocal!datasubset:a!queryEntity(query:a!query(pagingInfo:local!pagingInfo)),
    \ta!gridField(
    \ ttotalCount: local!datasubset.totalCount,
    \ tcolumns: {
    \ ta!gridTextColumn(
    \ t label: "",
    \ t data: index(local!datasubset.data,"",{}),
    \ t alignment: "LEFT"
    \ t),
    \ t
    \ t},
    \ tvalue: local!pagingInfo,
    \ tsaveInto: {
    \ tlocal!pagingInfo,
    \ ta!save(local!datasubset,a!queryEntity(query:a!query(pagingInfo:local!pagingInfo)))
    \ t}
    \t)
    )

    This way, you can make a query and refresh the datasubset only when you interact with the grid in the interface.
Children
No Data