找回密码
 立即注册

QQ登录

只需一步,快速开始

dexteryao 讲师达人认证 悬赏达人认证 SpreadJS 开发认证

超级版主

123

主题

8927

帖子

1万

积分

超级版主

Rank: 8Rank: 8

积分
13536

讲师达人悬赏达人元老葡萄SpreadJS 认证SpreadJS 高级认证微信认证勋章

dexteryao 讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2021-5-8 14:46  /   查看:1948  /  回复:0
本帖最后由 dexteryao 于 2021-5-8 14:46 编辑

在SpreadJS数据透视表中提供了视图管理(ViewManager)的功能。
ViewManager和pivotTable是一对一关系,通过ViewManager,可以管理当前透视表的状态。
将当前视图状态保存,选取已保存的状态进行恢复,快速切换视图。

用户使用视图管理的功能,可以创建自己的视图方便使用,如果需要多种数据透视场景同时查看时,不需要创建多个数据透视表,只需要切换视图即可。


在SpreadJS 数据面板中提供了该功能,保存SpreadJS ssjson时,ViewManager中的数据也会序列化到json中,方便下次打开使用。
pivotView.gif
通过API也可以操作ViewManager,具体API如下


  1. ///* class GC.Spread.Pivot.PivotTable.PivotTableViewManager
  2. /**
  3. * Represents a PivotTableViewManager.
  4. * @class
  5. */
  6. views
  7. GC.Spread.Pivot.PivotTable.PivotTableViewManager
  8. /**
  9. * @description Add a view to pivot table views.
  10. * @param {string} view Indicates the view to add.
  11. * @example
  12. * var viewsManager = pivotTable.views;
  13. * viewsManager.add({
  14. *      name: 'config1',
  15. *      config: pivotTable.serialize()
  16. * });
  17. * viewsManager.get('config1');
  18. */
  19. add(view:  IPivotTableView): boolean;
  20. /**
  21. * @description get all views from pivot table views.
  22. * @example
  23. * var viewsManager = pivotTable.views;
  24. * viewsManager.save('config1');
  25. * console.log(viewsManager.all());
  26. */
  27. all(): IPivotTableView[];
  28. /**
  29. * @description apply a view to current pivot table.
  30. * @param {string} name Indicates the name of view to apply.
  31. * @example
  32. * var viewsManager = pivotTable.views;
  33. * viewsManager.save('config1');
  34. * viewsManager.apply('config1');
  35. */
  36. apply(name:  string): void;
  37. /**
  38. * @description get a view from pivot table views.
  39. * @param {string} name Indicates the name of view to query.
  40. * @example
  41. * var viewsManager = pivotTable.views;
  42. * viewsManager.save('config1');
  43. * viewsManager.get('config1');
  44. */
  45. get(name:  string): IPivotTableView;
  46. /**
  47. * @description remove a view from pivot table views.
  48. * @param {string} name Indicates the name of view to remove.
  49. * @example
  50. * var viewsManager = pivotTable.views;
  51. * viewsManager.remove('config1');
  52. * viewsManager.get('config1');
  53. */
  54. remove(name:  string): void;
  55. /**
  56. * @description  Add a view to pivot table views.
  57. * @param {string} name Indicates the name of view to save.
  58. * @example
  59. * var viewsManager = pivotTable.views;
  60. * viewsManager.save('config1');
  61. * viewsManager.get('config1');
  62. */
  63. save(name:  string): boolean;
复制代码





0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部