File tree 1 file changed +23
-14
lines changed
src/dashboard/Data/Browser 1 file changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -1904,32 +1904,41 @@ class Browser extends DashboardView {
1904
1904
params = { this . props . location ?. search }
1905
1905
linkPrefix = { 'browser/' }
1906
1906
filterClicked = { url => {
1907
- // Reset to page 1
1908
- this . setState ( {
1909
- skip : 0 ,
1910
- } ) ;
1911
-
1907
+ this . resetPage ( ) ;
1912
1908
this . props . navigate ( generatePath ( this . context , url ) ) ;
1913
1909
} }
1914
1910
removeFilter = { filter => {
1915
- // Reset to page 1
1916
- this . setState ( {
1917
- skip : 0 ,
1918
- } ) ;
1919
-
1911
+ this . resetPage ( ) ;
1920
1912
this . removeFilter ( filter )
1921
1913
} }
1922
1914
classClicked = { ( ) => {
1923
- // Reset to page 1
1924
- this . setState ( {
1925
- skip : 0 ,
1926
- } ) ;
1915
+ this . resetPage ( ) ;
1927
1916
} }
1928
1917
categories = { allCategories }
1929
1918
/>
1930
1919
) ;
1931
1920
}
1932
1921
1922
+ /**
1923
+ * Resets the page to the first page of results and scrolls to the top.
1924
+ */
1925
+ resetPage ( ) {
1926
+ // Unselect any currently selected cell and cancel editing action
1927
+ this . dataBrowserRef . current . setCurrent ( null ) ;
1928
+ this . dataBrowserRef . current . setEditing ( false ) ;
1929
+
1930
+ // Scroll to top
1931
+ window . scrollTo ( {
1932
+ top : 0 ,
1933
+ behavior : 'smooth'
1934
+ } ) ;
1935
+
1936
+ // Reset pagination to page 1
1937
+ this . setState ( {
1938
+ skip : 0 ,
1939
+ } ) ;
1940
+ }
1941
+
1933
1942
showNote ( message , isError ) {
1934
1943
if ( ! message ) {
1935
1944
return ;
You can’t perform that action at this time.
0 commit comments