adds option for server sort (#4337)

This commit is contained in:
Arpit 2022-10-07 12:45:51 +05:30 committed by GitHub
parent 16935499b7
commit e441db9665
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

View file

@ -55,6 +55,7 @@ export function Table({
serverSidePagination,
clientSidePagination,
serverSideSearch,
serverSideSort,
displaySearchBox,
showDownloadButton,
showFilterButton,
@ -291,6 +292,7 @@ export function Table({
pageCount: -1,
manualPagination: false,
getExportFileBlob,
manualSortBy: serverSideSort,
},
useFilters,
useGlobalFilter,
@ -333,7 +335,7 @@ export function Table({
return {
sortedBy: {
column: columnName,
direction: state?.sortBy?.[0]?.desc ? 'descending' : 'ascending',
direction: state?.sortBy?.[0]?.desc ? 'desc' : 'asc',
},
};
}, [JSON.stringify(state)]);

View file

@ -6,6 +6,8 @@ export default function loadPropertiesAndStyles(properties, styles, darkMode, co
const serverSideSearch = properties.serverSideSearch ?? false;
const serverSideSort = properties.serverSideSort ?? false;
const displaySearchBox = properties.displaySearchBox ?? true;
const showDownloadButton = properties.showDownloadButton ?? true;
@ -49,6 +51,7 @@ export default function loadPropertiesAndStyles(properties, styles, darkMode, co
serverSidePagination,
clientSidePagination,
serverSideSearch,
serverSideSort,
displaySearchBox,
showDownloadButton,
showFilterButton,

View file

@ -830,6 +830,7 @@ class TableComponent extends React.Component {
'showBulkUpdateActions',
'showBulkSelector',
'highlightSelectedRow',
'serverSideSort',
];
let renderOptions = [];

View file

@ -155,6 +155,13 @@ export const widgets = [
schema: { type: 'boolean' },
},
},
serverSideSort: {
type: 'toggle',
displayName: 'Server-side sort',
validation: {
schema: { type: 'boolean' },
},
},
actionButtonBackgroundColor: {
type: 'color',
displayName: 'Background color',
@ -328,6 +335,7 @@ export const widgets = [
},
serverSidePagination: { value: '{{false}}' },
clientSidePagination: { value: '{{true}}' },
serverSideSort: { value: '{{false}}' },
displaySearchBox: { value: '{{true}}' },
showDownloadButton: { value: '{{true}}' },
showFilterButton: { value: '{{true}}' },