🎨 feat(table): add conditional row expansion for LogsTable
Implement rowExpandable property to control which rows can be expanded in the logs table. Rows are now only expandable when they have actual expand data content, preventing empty expansion sections from being displayed to users. - Add rowExpandable function to check if expandData exists and has content - Improve user experience by hiding expand functionality for rows without details - Maintain existing expand behavior for rows with valid expansion data
This commit is contained in:
@@ -1084,6 +1084,11 @@ const LogsTable = () => {
|
||||
return <Descriptions data={expandData[record.key]} />;
|
||||
};
|
||||
|
||||
// 检查是否有任何记录有展开内容
|
||||
const hasExpandableRows = () => {
|
||||
return logs.some(log => expandData[log.key] && expandData[log.key].length > 0);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{renderColumnSelector()}
|
||||
@@ -1252,8 +1257,10 @@ const LogsTable = () => {
|
||||
>
|
||||
<Table
|
||||
columns={getVisibleColumns()}
|
||||
expandedRowRender={expandRowRender}
|
||||
expandRowByClick={true}
|
||||
{...(hasExpandableRows() && {
|
||||
expandedRowRender: expandRowRender,
|
||||
expandRowByClick: true
|
||||
})}
|
||||
dataSource={logs}
|
||||
rowKey='key'
|
||||
loading={loading}
|
||||
|
||||
Reference in New Issue
Block a user