Skip to content
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

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

lilyli9
Copy link
Contributor

@lilyli9 lilyli9 commented Mar 1, 2023

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.

Screen Shot 2023-02-24 at 11 56 28 AM
Screen Shot 2023-02-24 at 11 56 37 AM
Screen Shot 2023-02-24 at 11 56 45 AM

@@ -29,6 +31,8 @@ export const DataTableViewColumn: React.FunctionComponent<
onEditColumnDescriptionRedirect,
}) => {
const [filterString, setFilterString] = React.useState('');
const [orderBoardByAsc, setOrderBoardByAsc] = React.useState(true);
Copy link
Collaborator

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) {
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the icon?

@lilyli9 lilyli9 requested a review from czgu March 2, 2023 20:01
Copy link
Collaborator

@czgu czgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

@czgu czgu merged commit c14babb into pinterest:master Mar 3, 2023
rohan-sh1 pushed a commit to CAI-TECHNOLOGIES/cai-ext-db-explorer that referenced this pull request Apr 11, 2023
* feat: add button to sort columns in view table UI

* chore: refactor orderBoardByAsc, filter logic
aidenprice pushed a commit to arrowtail-precision/querybook that referenced this pull request Jan 3, 2024
* feat: add button to sort columns in view table UI

* chore: refactor orderBoardByAsc, filter logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants