If you mean paginating the child items when querying the content for rendering, you can use the .Offset(skip, pageSize)
to specify page of results you want, and .IncludeTotalCount()
and GetTotalCount()
to get the grand total.
However, it means you can't use GetMappedResult<T>
instead you have to use GetWebPageResult
which allows use to use the GetTotalCount()
extension method on the result. After that, you can use the WebPageQueryResultMapper
to map the results to generated types.
Here's an example:
contentItemQueryBuilder.Parameters(q => q
.OrderBy(orderByColumns.ToArray())
.Offset(skip, pageSize)
.IncludeTotalCount()
);
var webpageResult = await _contentQueryExecutor.GetWebPageResult(
contentItemQueryBuilder,
contentItem => contentItem,
options: contentQueryExecutionOptions);
var totalCount = webpageResult.Any()
? webpageResult.First().GetTotalCount().GetValueOrDefault()
: 0;
var webPageItems = webpageResult
.Select(contentItem =>
(contentItem is IWebPageContentQueryDataContainer webItem)
? _webPageQueryResultMapper.Map<T>(webItem)
: null)
.ToList<T?>().CastToNonNullable();