DEV Community

方帅
方帅

Posted on

What should I do if the bottom and right borders of VTable are not displayed when it is scrolled?

Problem description

As shown in the screenshot, the table contents in VTable are not fully displayed (when there is a scroll bar). How can I display the right and bottom borders of the table?

Image description

Solution

You can add borderLineWidth and borderColor configurations in the frameStyle in the theme. However, after adding the above configurations, the borders on the top and left sides of the table and the borders of the cells will have two layers of borders, and the effect is not good.

Image description

After further research on the configuration, I found the cellInnerBorder configuration item, which is specifically designed to handle this situation. If you set it to false, the border lines of the cells on the edge will no longer be drawn.

The configuration items used are defined as follows:

/** frameStyle 是配置表格整体的样式 */
frameStyle ?:FrameStyle;
/** 单元格是否绘制内边框,如果为true,边界单元格靠近边界的边框会被隐藏 */
cellInnerBoder?:boolean;  // true | false
Enter fullscreen mode Exit fullscreen mode

Code example

const option = {
    records,
    columns,
    autoWrapText: true,
    limitMaxAutoWidth: 600,
    heightMode: 'autoHeight',
    theme:{
      frameStyle:{ // 配置的表格整体的边框
         borderLineWidth: 1, //  设置边框宽度
         borderColor: "#CBCBCB" //  设置边框颜色
      },
      cellInnerBorder:true  // 单元格是否绘制内边框,可结合情况设置true或false
    }
  };
  const tableInstance = new VTable.ListTable(container, option);
Enter fullscreen mode Exit fullscreen mode

Results show

Complete example:https://codesandbox.io/p/sandbox/vtable-frame-border-demo-forked-zn4n9j

Image description

Related Documents

Set table frame demo:https://codesandbox.io/p/sandbox/vtable-frame-border-demo-forked-zn4n9j

Related api:https://www.visactor.io/vtable/option/ListTable#theme.cellInnerBorder

https://www.visactor.io/vtable/option/ListTable#theme.frameStyle.borderLineWidth

https://www.visactor.io/vtable/option/ListTable#theme.frameStyle.borderColor

github:https://github.com/VisActor/VTable

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay