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

[Question] How to add timeline to play a schedule data using vtable #755

Open
zairl23 opened this issue Dec 16, 2023 · 5 comments
Open

[Question] How to add timeline to play a schedule data using vtable #755

zairl23 opened this issue Dec 16, 2023 · 5 comments

Comments

@zairl23
Copy link

zairl23 commented Dec 16, 2023

Just find the schedule example using vtable: https://visactor.io/vtable/demo/business/project-schedule, now i want to add a timeline to play the schedule, and the table can scroll in a certain frequence, how to achieve this target?

@fangsmile
Copy link
Contributor

use api:
setScrollLeft
or
scrollToCell(cellAddr: { col?: number; row?: number })=>void
@zairl23

@zairl23
Copy link
Author

zairl23 commented Dec 18, 2023

Thank you! Another question: is there the api to draw a vertical red lines in the vtable which can move by following scrollToCell api call。 @fangsmile

@fangsmile
Copy link
Contributor

image
可以自定义渲染

args.table.getSelectedCellInfos() 获取选中状态 判断后确定自定义渲染元素应该什么

@zairl23
Copy link
Author

zairl23 commented Dec 22, 2023

can draw this vertical line using cusomRenderer and animate the vertical line
@fangsmile
image

@fangsmile
Copy link
Contributor

滚动好搞,示例后面加这么一段话:

let animationId;
let scrollX=0;
let t = Date.now();
function animate() {
  console.log('animate')
  // 更新动画的逻辑代码
  const t1 = Date.now();
  if (scrollX>=tableInstance.getAllColsWidth()) {
    console.log('cancelAnimationFrame');
    cancelAnimationFrame(animationId);
    return;
  }
  if(t1-t>=30){
    t=t1;
    tableInstance.setScrollLeft(scrollX);
    scrollX+=3;
  }
  // 执行动画播放
  animationId = requestAnimationFrame(animate);
}

// 开始动画播放
animationId = requestAnimationFrame(animate);

不过如果支持那条竖线需要写自定义函数了。可以加我们的飞书交流群找我进行具体业务场景的交流
飞书群
@zairl23

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