Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(pivottable): refresh
Browse files Browse the repository at this point in the history
1.pivotTable refresh when init on other worksheet 2.docs
  • Loading branch information
Dushusir committed Jan 7, 2021
1 parent 60ce8c5 commit 78330c9
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- 张铭 ¥ 200
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9

## 贡献者和感谢

Expand All @@ -210,6 +211,7 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- [@swen-xiong](https://github.com/swen-xiong)
- [@lzmch](https://github.com/lzmch)
- [@kdevilpf](https://github.com/kdevilpf)
- [@WJWM0316](https://github.com/WJWM0316)

## 版权信息
[MIT](http://opensource.org/licenses/MIT)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- 张铭 ¥ 200
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9

## Authors and acknowledgment

Expand All @@ -195,6 +196,7 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- [@swen-xiong](https://github.com/swen-xiong)
- [@lzmch](https://github.com/lzmch)
- [@kdevilpf](https://github.com/kdevilpf)
- [@WJWM0316](https://github.com/WJWM0316)

## License
[MIT](http://opensource.org/licenses/MIT)
Expand Down
3 changes: 2 additions & 1 deletion docs/about/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ Luckysheet is a project led by an individual and jointly developed by several fr
- [@gsw945](https://github.com/gsw945)
- [@swen-xiong](https://github.com/swen-xiong)
- [@lzmch](https://github.com/lzmch)
- [@kdevilpf](https://github.com/kdevilpf)
- [@kdevilpf](https://github.com/kdevilpf)
- [@WJWM0316](https://github.com/WJWM0316)
1 change: 1 addition & 0 deletions docs/about/sponsor.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
- 张铭 ¥ 200
- 曹治军 ¥ 1
- *特 ¥ 10
- **权 ¥ 9.9
3 changes: 2 additions & 1 deletion docs/zh/about/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ Luckysheet是由个人主导、几个志同道合的小伙伴一同开发的项
- [@gsw945](https://github.com/gsw945)
- [@swen-xiong](https://github.com/swen-xiong)
- [@lzmch](https://github.com/lzmch)
- [@kdevilpf](https://github.com/kdevilpf)
- [@kdevilpf](https://github.com/kdevilpf)
- [@WJWM0316](https://github.com/WJWM0316)
3 changes: 2 additions & 1 deletion docs/zh/about/sponsor.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
- 小李飞刀刀 ¥ 66
- 张铭 ¥ 200
- 曹治军 ¥ 1
- *特 ¥ 10
- *特 ¥ 10
- **权 ¥ 9.9
21 changes: 20 additions & 1 deletion docs/zh/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,12 +955,31 @@ Luckysheet开放了更细致的自定义配置选项,分别有
- 类型:Function
- 默认值:null
- 作用:鼠标滚动事件
- 参数:{, , }
- 参数:
- {Object} [position]:
+ {Number} [scrollLeft]:横向滚动条的位置
+ {Number} [scrollTop]:垂直滚动条的位置
+ {Number} [canvasHeight]:canvas高度

------------
### cellDragStop

- 类型:Function
- 默认值:null
- 作用:鼠标拖拽文件到Luckysheet内部的结束事件
- 参数:
- {Object} [cell]:单元格对象
- {Object} [postion]:
+ {Number} [r]:单元格所在行号
+ {Number} [c]:单元格所在列号
+ {Number} [start_r]:单元格左上角的水平坐标
+ {Number} [start_c]:单元格左上角的垂直坐标
+ {Number} [end_r]:单元格右下角的水平坐标
+ {Number} [end_c]:单元格右下角的垂直坐标
- {Object} [sheet]:当前sheet对象
- {Object} [ctx]: 当前画布的context
- {Object} [event]: 当前事件对象

------------

## 选区操作(包括单元格)
Expand Down
1 change: 1 addition & 0 deletions src/controllers/pivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ const pivotTable = {

_this.getCellData(index);
_this.initialPivotManage(true);
_this.refreshPivotTable(); //初始化在一个普通sheet页,从此普通sheet页切换到数据透视表页时,需要刷新下数据,否则还是旧数据
},
refreshPivotTable: function (isRefreshCanvas=true) {
let _this = this;
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/sheetmanage.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ const sheetmanage = {

if (!!file.isPivotTable) {
Store.luckysheetcurrentisPivotTable = true;
pivotTable.changePivotTable(Store.currentSheetIndex);
// pivotTable.changePivotTable(Store.currentSheetIndex); //此方法需要注释掉,在restoreSheetAll中已经执行了刷新了数据透视表,这里就不需要了
}
else {
Store.luckysheetcurrentisPivotTable = false;
Expand Down
3 changes: 2 additions & 1 deletion src/global/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5364,7 +5364,8 @@ export function hideGridLines(options = {}){
* @param {Function} options.success 操作结束的回调函数
*/
export function refresh(options = {}) {
luckysheetrefreshgrid();
// luckysheetrefreshgrid();
jfrefreshgrid();

let {
success
Expand Down
4 changes: 3 additions & 1 deletion src/global/setdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ function setcellvalue(r, c, d, v) {
return;
}

if(isRealNull(cell)){
// 1.为null
// 2.数据透视表的数据,flowdata的每个数据可能为字符串,结果就是cell == v == 一个字符串或者数字数据
if(isRealNull(cell) || (getObjType(cell) === 'string' || getObjType(cell) === 'number') && cell === v){
cell = {};
}

Expand Down
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
}
],
hook:{
cellDragStop: function (cell, postion, sheetFile, moveState, ctx, event) {
console.info(cell, postion, sheetFile, ctx, event);
cellDragStop: function (cell, postion, sheetFile, ctx, event) {
// console.info(cell, postion, sheetFile, ctx, event);
},
rowTitleCellRenderBefore:function(rowNum,postion,ctx){
// console.log(rowNum);
Expand Down

0 comments on commit 78330c9

Please sign in to comment.