naive-ui
naive-ui copied to clipboard
resizable data table columns
This function solves the problem (这个功能解决的问题)
allowing the user to select at runtime the best column size for their needs
Expected API (期望的 API)
probably a boolean prop to allow the column resize
We will consider it.
We will consider it.
@07akioni 老哥,就你一个人在维护组件库啊,有点难顶哦
Implemented resizable columns is this gist. It turned out to be not so hard.
Some preparations must be done to use it:
- global style override
th.n-data-table-th { padding: 0 !important; }
- Each resizable column defenition in array must be liko so:
{ key: 'rate', title: createResizableColumnTitle('Rate'), width: 150 }
It has to have width! - Columns must be reactive e.g
const columns = reactive(createColumns());
- usage of scroll-x prop is not recommended as all columns width defined
@Bulkman hi, will you share a demo for it?
你这方案不行啊,拖动了表格线还是不动
Hello! Thanks for the amazing library. Any plans/updates on column resize feature? Thank you.
track in #3165