File tree Expand file tree Collapse file tree 1 file changed +23
-14
lines changed
src/dashboard/Data/Browser Expand file tree Collapse file tree 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 {
19041904 params = { this . props . location ?. search }
19051905 linkPrefix = { 'browser/' }
19061906 filterClicked = { url => {
1907- // Reset to page 1
1908- this . setState ( {
1909- skip : 0 ,
1910- } ) ;
1911-
1907+ this . resetPage ( ) ;
19121908 this . props . navigate ( generatePath ( this . context , url ) ) ;
19131909 } }
19141910 removeFilter = { filter => {
1915- // Reset to page 1
1916- this . setState ( {
1917- skip : 0 ,
1918- } ) ;
1919-
1911+ this . resetPage ( ) ;
19201912 this . removeFilter ( filter )
19211913 } }
19221914 classClicked = { ( ) => {
1923- // Reset to page 1
1924- this . setState ( {
1925- skip : 0 ,
1926- } ) ;
1915+ this . resetPage ( ) ;
19271916 } }
19281917 categories = { allCategories }
19291918 />
19301919 ) ;
19311920 }
19321921
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+
19331942 showNote ( message , isError ) {
19341943 if ( ! message ) {
19351944 return ;
You can’t perform that action at this time.
0 commit comments