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

DataTable 组件是否可以加入单选模式(radio) #3056

Closed
kitaharafay opened this issue Jun 8, 2022 · 10 comments
Closed

DataTable 组件是否可以加入单选模式(radio) #3056

kitaharafay opened this issue Jun 8, 2022 · 10 comments
Labels
feature request New feature or request pr welcome

Comments

@kitaharafay
Copy link

kitaharafay commented Jun 8, 2022

This function solves the problem (这个功能解决的问题)

There'a a scene, we only want to select single row of data-table.

有这样一个场景:我们使用DataTable有且只需要选择一行。
现在 type只有'selection' | 'expand'两个选择,使用selection会在TableHeader出现全选checkbox,这个并不是我们需要的

Expected API (期望的 API)

DataTableColumn Properties
type: 'selection' | 'expand' | 'radio'

@github-actions github-actions bot added the feature request New feature or request label Jun 8, 2022
@07akioni
Copy link
Collaborator

07akioni commented Jun 8, 2022

会考虑,优先级暂时不是很高,欢迎 PR

Will do, however priority is not high. PR is welcomed.

@binghc
Copy link

binghc commented Jun 20, 2022

table 有个bug 设置了固定表头maxHeight,水平滚动条不显示,导致table数据显示不全

@07akioni
Copy link
Collaborator

table 有个bug 设置了固定表头maxHeight,水平滚动条不显示,导致table数据显示不全

给个复现?

@binghc
Copy link

binghc commented Jun 20, 2022

这很容易,在官方文档table组件位置随便这个demo或者自己写一个,吧table放在在一个有限大小的div里面,比如这样

<div style="width:500px;height:500px;overflow: auto;padding:5px;background: orange;">
        <n-data-table
                :columns="[				
                    {
                        title: 'Name',
                        key: 'name',
                        width: 300,
                    },
                    {
                        title: 'Age',
                        key: 'age',
                        width: 300,
                    },
                    {
                        title: 'Address',
                        key: 'address',
                        width: 300,
                    }
                ]"
                :data="data"
                :pagination="pagination"
                :maxHeight="150"
                v-model:checked-row-keys="checkedRowKeys"
        />
    </div>

@binghc
Copy link

binghc commented Jun 20, 2022

刚又发现table一个bug,没有给table设置maxHeight固定表头,这个table依然放在一个高度和宽度都比table小的父容器里面,这时table会有垂直滚动条和水平滚动条,这没问题,但是只有垂直滚动条滚到下面才能看到水平滚动条

@binghc
Copy link

binghc commented Jun 20, 2022

另外再提一个tree懒加载的一个bug,配置了expand-on-click,如果用户点击的这个节点还没有加载数据会报错

@07akioni
Copy link
Collaborator

另外再提一个tree懒加载的一个bug,配置了expand-on-click,如果用户点击的这个节点还没有加载数据会报错

这个应该是修了,在 2.30.4

image

@07akioni
Copy link
Collaborator

另外再提一个tree懒加载的一个bug,配置了expand-on-click,如果用户点击的这个节点还没有加载数据会报错

还有就是 issue 的讨论最好单独开,不要混在其他的 issue 里,不然很可能被漏掉

@07akioni
Copy link
Collaborator

这种情况不被看作 bug,必须要设定 scroll-x

Jevon617 added a commit to Jevon617/naive-ui that referenced this issue Jun 29, 2022
Jevon617 added a commit to Jevon617/naive-ui that referenced this issue Jul 4, 2022
07akioni added a commit that referenced this issue Jul 4, 2022
* feat(datatable): add `single` prop to datatable #3056

* test(datatable): add `single` prop test case

* fix: `single` test case

* docs: add english changelog

* test(data-table): accomplish `single` prop test case

* feat: change checkout to radio

* Update src/data-table/src/TableParts/Body.tsx

Co-authored-by: 07akioni <07akioni2@gmail.com>
@07akioni
Copy link
Collaborator

07akioni commented Jul 4, 2022

closed in #3209

@07akioni 07akioni closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request pr welcome
Projects
None yet
Development

No branches or pull requests

3 participants