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

ST: Using multiple fixed columns and virtualScroll together cause abnormal style #2380

Open
kevindaizj opened this issue Mar 7, 2023 · 0 comments

Comments

@kevindaizj
Copy link

kevindaizj commented Mar 7, 2023

Reproduction link

https://stackblitz.com/edit/angular-fjxqgn?file=src%2Fapp%2Fapp.component.ts

Steps to reproduce

  1. 打开重现链接。⚠️注意:程序加载完成前,先调整展示窗口以显示大屏幕下的表格样式 (或调整窗口后再刷新一下),否则无法清楚重现此问题。
  2. 横向滚动时,固定列并没有保持固定。

8D3153592FE64793626EF0907166359C

  1. 查看html元素,发现元素的 leftright 属性都为0,并没有正确设置。

7C063D4131D8469C4782C4DF689A40D6

  1. ng-zorro也有类似的issue: ng-zorro-antd issue #7822

核心代码如下

import { Component, ViewChild } from '@angular/core';
import { STColumn, STComponent, STPage } from '@delon/abc/st';

@Component({
  selector: 'components-st-virtual',
  template: `
    
    <st #st [data]="data" [columns]="columns" [page]="page" virtualScroll [scroll]="{ x: '1300px', y: '240px' }"></st>
  `,
})
export class ComponentsStVirtualComponent {
  @ViewChild('st', { static: false }) st!: STComponent;

  page: STPage = {
    front: false,
    show: false,
  };
  data: Array<{ id: number; price: number }> = Array(2000)
    .fill({})
    .map((_, idx) => ({
      id: idx   1,
      price: ~~(Math.random() * 100),
    }));
  columns: STColumn[] = [
    { title: '编号', index: 'id', width: 100, fixed: 'left' },
    { title: '价格1', index: 'price', width: 100, fixed: 'left' },
    { title: '价格2', index: 'price', width: 100 },
    { title: '价格3', index: 'price', width: 100 },
    { title: '价格4', index: 'price', width: 100 },
    { title: '价格5', index: 'price', width: 100 },
    { title: '价格6', index: 'price', width: 100 },
    { title: '价格7', index: 'price', width: 100 },
    { title: '价格8', index: 'price', width: 100 },
    { title: '价格9', index: 'price', width: 100, fixed: 'right' },
    { title: '价格10', index: 'price', width: 100, fixed: 'right' },
  ];
}

What is expected?

所有固定列保持固定

What is actually happening?

除第一个和最后的固定列,其余固定列在横向滚动过程中都没有固定

Environment Info
ng-alain 15.1.0
Browser Chrome 110.0.5481.177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants