-
Notifications
You must be signed in to change notification settings - Fork 233
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
feat: add button to sort columns in view table UI #1187
feat: add button to sort columns in view table UI #1187
Conversation
@@ -29,6 +31,8 @@ export const DataTableViewColumn: React.FunctionComponent< | |||
onEditColumnDescriptionRedirect, | |||
}) => { | |||
const [filterString, setFilterString] = React.useState(''); | |||
const [orderBoardByAsc, setOrderBoardByAsc] = React.useState(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orderColumnsBy?
@@ -39,25 +43,56 @@ export const DataTableViewColumn: React.FunctionComponent< | |||
if (numberOfRows != null) { | |||
filteredCols.splice(numberOfRows); | |||
} | |||
if (orderBoardBy) { | |||
if (orderBoardByAsc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filteredCols.sort((a, b) =>
(a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1) * (orderBoardByAsc ? 1 : -1)
);
onSearch={(s) => setFilterString(s)} | ||
isSearching={false} | ||
placeholder={`Find Columns`} | ||
hasIcon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work!
* feat: add button to sort columns in view table UI * chore: refactor orderBoardByAsc, filter logic
* feat: add button to sort columns in view table UI * chore: refactor orderBoardByAsc, filter logic
This adds a button to the View Table UI to allow users to switch between sorting column field names in ascending/descending alphabetical order, and to revert to the Default(as ordered in the database) order.