You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2021/10/13 17:26:22 UTC
[superset] branch hugh/alphabetical-select updated: add
alphabetical order
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch hugh/alphabetical-select
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/hugh/alphabetical-select by this push:
new 1d059a8 add alphabetical order
1d059a8 is described below
commit 1d059a8234c41a0a4eafa465bc50834d13cbd556
Author: hughhhh <hu...@gmail.com>
AuthorDate: Wed Oct 13 13:24:48 2021 -0400
add alphabetical order
---
superset-frontend/src/components/Select/Select.tsx | 4 +++-
superset-frontend/src/components/TableSelector/index.tsx | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/src/components/Select/Select.tsx b/superset-frontend/src/components/Select/Select.tsx
index 1578562..55af144 100644
--- a/superset-frontend/src/components/Select/Select.tsx
+++ b/superset-frontend/src/components/Select/Select.tsx
@@ -93,6 +93,7 @@ export interface SelectProps extends PickedSelectProps {
pageSize?: number;
invertSelection?: boolean;
fetchOnlyOnSearch?: boolean;
+ keepOrder?: boolean;
onError?: (error: string) => void;
}
@@ -177,6 +178,7 @@ const Select = ({
invertSelection = false,
labelInValue = false,
lazyLoading = true,
+ keepOrder = false, // keep order of options
loading,
mode = 'single',
name,
@@ -246,7 +248,7 @@ const Select = ({
: selectedValue === opt.value;
}
- if (found) {
+ if (found && !keepOrder) {
topOptions.push(opt);
} else {
otherOptions.push(opt);
diff --git a/superset-frontend/src/components/TableSelector/index.tsx b/superset-frontend/src/components/TableSelector/index.tsx
index e7a99cc..b347562 100644
--- a/superset-frontend/src/components/TableSelector/index.tsx
+++ b/superset-frontend/src/components/TableSelector/index.tsx
@@ -310,8 +310,9 @@ const TableSelector: FunctionComponent<TableSelectorProps> = ({
onChange={(table: TableOption) => internalTableChange(table)}
options={tableOptions}
placeholder={t('Select table or type table name')}
- showSearch
value={currentTable}
+ showSearch
+ keepOrder
/>
);