DataListGridStore.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * @Description: 列表store
  3. * @Author: hy
  4. * @Date: 2019-08-12 18:34:16
  5. * @LastEditTime: 2019-08-19 17:16:28
  6. */
  7. Ext.define('uas.store.DataListGridStore', {
  8. extend: 'Ext.data.Store',
  9. alias: 'store.dataListGridStore',
  10. model: 'uas.model.DataListGridModel',
  11. pageSize: 100,
  12. proxy: {
  13. type: 'ajax',
  14. url: '/api/dataList',
  15. reader: {
  16. type: 'json',
  17. rootProperty: 'data.list',
  18. idProperty: 'id',
  19. totalProperty: 'data.total'
  20. }
  21. },
  22. autoLoad:true,
  23. remoteSort: false,
  24. listeners:{
  25. beforeload: function (store, op) {},
  26. load: function(store, records, successful, operation, eOpts) {
  27. const grid = store.grid;
  28. const paging = grid.down('[xtype=dataListPaging]');
  29. const pageCountItem = paging.down('#pageCountItem');
  30. const dataCount = paging.down('#dataCountItem');
  31. if(store.totalCount!==Number.MAX_SAFE_INTEGER){
  32. //展示*号
  33. if(store.currentPage===Number.MAX_SAFE_INTEGER){
  34. let page = store.totalCount/store.pageSize;
  35. page = page>parseInt(page)?page+1:page;
  36. store.currentPage = page;
  37. paging.down('#inputItem').setValue(page);
  38. }
  39. pageCountItem.update(Ext.String.format(paging.afterPageText,store.currentPage));
  40. dataCount.setValue("行/共"+store.totalCount+"行");
  41. }
  42. }
  43. }
  44. });