Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议:把<gantt>的start和end属性也加入onChange检测 #237

Closed
naruto00fa opened this issue May 24, 2022 · 3 comments
Closed

建议:把<gantt>的start和end属性也加入onChange检测 #237

naruto00fa opened this issue May 24, 2022 · 3 comments

Comments

@naruto00fa
Copy link

把的start和end属性也加入onChange检测,否则修改这两个值,不能改变甘特图x轴,现在我只能用如下方法刷新:
//通过修改viewType再修改回来,触发甘特图的横轴重新绘制
private _sendGanttRangeChange(){
let temp = this.cycleSelected;
this.cycleSelected = '';
setTimeout(()=>{
this.cycleSelected = temp;
},100);
}

@walkerkay
Copy link
Collaborator

ngx-gantt 使用了使用了 Angular 的 OnPush 变化检测,推荐使用不可变数据来触发变化检测

@naruto00fa
Copy link
Author

抱歉,没看明白,比如说用什么数据来触发?

@walkerkay
Copy link
Collaborator

抱歉,没看明白,比如说用什么数据来触发?

简单理解,只要 items 参数发生变化后就会触发检测,使用方可以在修改数据后重新赋值来触发变化检测,保证每一次修改后 items 都是新的引用,或者也可以引入 immutable.js

   this.items=[...this.items];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants