@@ -106,6 +106,7 @@ export default class DataBrowser extends React.Component {
106106 this . state = {
107107 order : order ,
108108 current : null ,
109+ lastSelectedCol : 0 ,
109110 editing : false ,
110111 copyableValue : undefined ,
111112 selectedObjectId : undefined ,
@@ -197,6 +198,7 @@ export default class DataBrowser extends React.Component {
197198 this . setState ( {
198199 order : order ,
199200 current : null ,
201+ lastSelectedCol : 0 ,
200202 editing : false ,
201203 simplifiedSchema : this . getSimplifiedSchema ( props . schema , props . className ) ,
202204 allClassesSchema : this . getAllClassesSchema ( props . schema , props . classes ) ,
@@ -270,6 +272,12 @@ export default class DataBrowser extends React.Component {
270272 }
271273 }
272274
275+ if ( this . state . current && this . state . current !== prevState . current ) {
276+ if ( this . state . current . col !== this . state . lastSelectedCol ) {
277+ this . setState ( { lastSelectedCol : this . state . current . col } ) ;
278+ }
279+ }
280+
273281 // Auto-load first row if enabled and conditions are met
274282 if (
275283 this . state . autoLoadFirstRow &&
@@ -285,7 +293,15 @@ export default class DataBrowser extends React.Component {
285293 this . setShowAggregatedData ( true ) ;
286294 this . setSelectedObjectId ( firstRowObjectId ) ;
287295 // Also set the current cell to the first cell of the first row
288- this . setCurrent ( { row : 0 , col : 0 } ) ;
296+ let col =
297+ this . state . lastSelectedCol !== undefined &&
298+ prevProps . className === this . props . className
299+ ? this . state . lastSelectedCol
300+ : 0 ;
301+ if ( col >= this . state . order . length ) {
302+ col = 0 ;
303+ }
304+ this . setCurrent ( { row : 0 , col } ) ;
289305 this . handleCallCloudFunction (
290306 firstRowObjectId ,
291307 this . props . className ,
@@ -437,7 +453,12 @@ export default class DataBrowser extends React.Component {
437453 const firstRowObjectId = this . props . data [ 0 ] . id ;
438454 this . setShowAggregatedData ( true ) ;
439455 this . setSelectedObjectId ( firstRowObjectId ) ;
440- this . setCurrent ( { row : 0 , col : 0 } ) ;
456+ let col =
457+ this . state . lastSelectedCol !== undefined ? this . state . lastSelectedCol : 0 ;
458+ if ( col >= this . state . order . length ) {
459+ col = 0 ;
460+ }
461+ this . setCurrent ( { row : 0 , col } ) ;
441462 this . handleCallCloudFunction (
442463 firstRowObjectId ,
443464 this . props . className ,
0 commit comments