@@ -52,17 +52,11 @@ class TableWidget(WIDGET_BASE):
5252 large BigQuery DataFrames within a Jupyter environment.
5353 """
5454
55+ page = traitlets .Int (0 ).tag (sync = True )
5556 page_size = traitlets .Int (0 ).tag (sync = True )
56- # Use dynamic default
57- page_size = traitlets .Int ().tag (sync = True )
5857 row_count = traitlets .Int (0 ).tag (sync = True )
5958 table_html = traitlets .Unicode ().tag (sync = True )
6059
61- @traitlets .default ("page_size" )
62- def _page_size_default (self ):
63- """Set the default page size from display options."""
64- return bigframes .options .display .max_rows
65-
6660 def __init__ (self , dataframe : bigframes .dataframe .DataFrame ):
6761 """Initialize the TableWidget.
6862
@@ -75,6 +69,7 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
7569 )
7670
7771 self ._dataframe = dataframe
72+ # This flag is used to prevent observers from firing during initialization.
7873 self ._initializing = True
7974 super ().__init__ ()
8075
@@ -85,11 +80,11 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
8580 self ._cached_batches : List [pd .DataFrame ] = []
8681
8782 # Respect display options for initial page size
88- initial_page_size = bigframes .options .display .max_rows
83+ self . page_size = bigframes .options .display .max_rows
8984
9085 self ._batches : bigframes .core .blocks .PandasBatches = cast (
9186 bigframes .core .blocks .PandasBatches ,
92- dataframe .to_pandas_batches (page_size = initial_page_size ),
87+ dataframe .to_pandas_batches (page_size = self . page_size ),
9388 )
9489
9590 # The query issued by `to_pandas_batches()` already contains metadata
@@ -110,11 +105,6 @@ def _css(self):
110105 """Load CSS code from external file."""
111106 return resources .read_text (bigframes .display , "table_widget.css" )
112107
113- page = traitlets .Int (0 ).tag (sync = True )
114- page_size = traitlets .Int ().tag (sync = True )
115- row_count = traitlets .Int (0 ).tag (sync = True )
116- table_html = traitlets .Unicode ().tag (sync = True )
117-
118108 @traitlets .validate ("page" )
119109 def _validate_page (self , proposal : Dict [str , Any ]) -> int :
120110 """Validate and clamp the page number to a valid range.
0 commit comments