Skip to content

Commit

Permalink
adds option for server sort (ToolJet#4337)
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitnath authored Oct 7, 2022
1 parent 1693549 commit e441db9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/Editor/Components/Table/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function Table({
serverSidePagination,
clientSidePagination,
serverSideSearch,
serverSideSort,
displaySearchBox,
showDownloadButton,
showFilterButton,
Expand Down Expand Up @@ -291,6 +292,7 @@ export function Table({
pageCount: -1,
manualPagination: false,
getExportFileBlob,
manualSortBy: serverSideSort,
},
useFilters,
useGlobalFilter,
Expand Down Expand Up @@ -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)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -49,6 +51,7 @@ export default function loadPropertiesAndStyles(properties, styles, darkMode, co
serverSidePagination,
clientSidePagination,
serverSideSearch,
serverSideSort,
displaySearchBox,
showDownloadButton,
showFilterButton,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/Editor/Inspector/Components/Table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ class TableComponent extends React.Component {
'showBulkUpdateActions',
'showBulkSelector',
'highlightSelectedRow',
'serverSideSort',
];

let renderOptions = [];
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/Editor/WidgetManager/widgetConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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}}' },
Expand Down

0 comments on commit e441db9

Please sign in to comment.