-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
table API 'expandIcon' not working #751
Comments
You can submit pr directly. |
I also need this. |
Hello tangjinzhou, I hava tried in Chrome with ant-design-vue 1.3.10, "expandIcon" still cannot work by use slot. <a-table AAA Could you help me? |
"expandIcon" still cannot work by use slot. |
Workaround by JSX. BTW, using 'children' as the key to render sub-table's dataSoure may cause weird behaviour and that's why I use 'children2' instead. const columns = [ { title: "A", dataIndex: "A" }];
const tableData = [{ key: 1, A: 1, children2: [ { key: 11, A: 2} ]}, { key: 2, A: 1, children2: [] }];
export default {
data() {
return {
tableData,
columns,
loading: false,
expandedRowKeys: []
};
},
methods: {
getExpandIcon({ expanded, record, onExpand }) {
if (!record.children2 || !record.children2.length) return "";
return (
<a-icon
type={expanded ? "minus-square" : "plus-square"}
{...{
on: {
click: onExpand.bind(this, [expanded, record])
}
}}
/>
);
}
},
render() {
return (
<a-spin spinning={this.loading}>
<a-table
columns={this.columns}
dataSource={this.tableData}
expandedRowKeys={this.expandedRowKeys}
expandIcon={this.getExpandIcon}
{...{
on: {
expandedRowsChange: (val) => this.expandedRowKeys = val;
}
}}
scopedSlots={{
expandedRowRender: record => {
if (!record.children2 || !record.children2.length) return "";
return (
<a-table
columns={columns}
dataSource={record.children2}
pagination={false}
></a-table>
);
}
}}
/>
</a-spin>
);
}
}; |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
undefined
Environment
windows10, chrome 73.0.3683.103, vue 2.6.6, ant-design-vue 1.3.5
Reproduction link
Steps to reproduce
In App.vue, method 'expandIcon' never runs.
What is expected?
change the expand icon
What is actually happening?
The doc says that adding the 'expandIcon' prop can change the expand icon, but it doesn't really work.
I've checked the components/table/interface.js, and there isn't 'expandIcon' in TableProps. When I added it('expandIcon: PropTypes.func') in , it worked.
So is it just forgotten or there is some other reason?
The text was updated successfully, but these errors were encountered: