Feature :: Table sort disable/enable (#4142)

* feat :: disable sorting

* disable action buttons

* cleanup

* cleanup

* revert :: unwanted changes
This commit is contained in:
Kiran Ashok 2022-10-13 14:32:44 +05:30 committed by GitHub
parent f734ba0d3a
commit 5a88464600
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 0 deletions

View file

@ -81,6 +81,7 @@ export function Table({
parsedDisabledState,
actionButtonRadius,
actions,
disabledSort,
} = loadPropertiesAndStyles(properties, styles, darkMode, component);
const { t } = useTranslation();
@ -347,6 +348,7 @@ export function Table({
pageCount: -1,
manualPagination: false,
getExportFileBlob,
disableSortBy: disabledSort,
manualSortBy: serverSideSort,
},
useFilters,

View file

@ -3,6 +3,7 @@ import React from 'react';
const generateActionsData = ({ actions, columnSizes, defaultColumn, fireEvent, setExposedVariables }) => {
const leftActions = () => actions.filter((action) => action.position === 'left');
const rightActions = () => actions.filter((action) => [undefined, 'right'].includes(action.position));
const leftActionsCellData =
leftActions().length > 0
? [

View file

@ -5,6 +5,7 @@ export default function loadPropertiesAndStyles(properties, styles, darkMode, co
if (typeof serverSidePagination !== 'boolean') serverSidePagination = false;
const serverSideSearch = properties.serverSideSearch ?? false;
const disabledSort = properties?.disabledSort ?? false;
const serverSideSort = properties.serverSideSort ?? false;
@ -70,5 +71,6 @@ export default function loadPropertiesAndStyles(properties, styles, darkMode, co
actionButtonRadius,
loadingState,
actions,
disabledSort,
};
}

View file

@ -862,6 +862,7 @@ class TableComponent extends React.Component {
'showBulkUpdateActions',
'showBulkSelector',
'highlightSelectedRow',
'disabledSort',
'serverSideSort',
'serverSideFilter',
];

View file

@ -141,6 +141,13 @@ export const widgets = [
schema: { type: 'boolean' },
},
},
disabledSort: {
type: 'toggle',
displayName: 'Disable sorting',
validation: {
schema: { type: 'boolean' },
},
},
clientSidePagination: {
type: 'toggle',
displayName: 'Client-side pagination',