cube.js 查询分页的处理

cube.js 对于查询的处理都是自动生成sql的,同样对于分页的处理也是类似的,目前官方的play ground 对于分页暂时没有可视化操作
但是查询api 是支持的

参考查询格式

cube.js 提供的 api 查询支持是支持分页处理的,包含的参数主要是limit 以及offset

 

 

参考分页处理

 
{
  measures: ['Stories.count'],
  dimensions: ['Stories.category'],
  filters: [{
    member: 'Stories.isDraft',
    operator: 'equals',
    values: ['No']
  }],
  timeDimensions: [{
    dimension: 'Stories.time',
    dateRange: ['2015-01-01', '2015-12-31'],
    granularity: 'month'
  }],
  limit: 100,  // 页面处理
  offset: 50,  // 页面处理
  order: {
    'Stories.time': 'asc',
    'Stories.count': 'desc'
  },
  timezone: 'America/Los_Angeles'
}

说明

以下链接包含了查询格式的说明以及参考实例,可以方便的学习cube.js 对于分页的处理

参考资料

https://cube.dev/docs/query-format
https://github.com/cube-js/cube.js/blob/master/examples/material-ui-dashboard/dashboard-app/src/pages/DataTablePage.js

posted on 2021-01-18 21:33  荣锋亮  阅读(218)  评论(0编辑  收藏  举报

导航