Skip to content

feat: add button to sort columns in view table UI - #1187

Merged
czgu merged 2 commits into
pinterest:masterfrom
lilyli9:external/sort-table-column-names
Mar 3, 2023
Merged

czgu merged 2 commits into
pinterest:masterfrom
lilyli9:external/sort-table-column-names

Conversation

@lilyli9

@lilyli9 lilyli9 commented Mar 1, 2023

Copy link
Copy Markdown
Contributor

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

onEditColumnDescriptionRedirect,
}) => {
const [filterString, setFilterString] = React.useState('');
const [orderBoardByAsc, setOrderBoardByAsc] = React.useState(true);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

orderColumnsBy?

filteredCols.splice(numberOfRows);
}
if (orderBoardBy) {
if (orderBoardByAsc) {

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

@czgu czgu left a comment

Copy link
Copy Markdown
Collaborator

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