@@ -844,15 +844,16 @@ def _get_display_df_and_blob_cols(self) -> tuple[DataFrame, list[str]]:
844844 df [col ] = df [col ].blob ._get_runtime (mode = "R" , with_metadata = True )
845845 return df , blob_cols
846846
847- def _get_anywidget_bundle (self , include = None , exclude = None ):
847+ def _get_anywidget_bundle (
848+ self , include = None , exclude = None
849+ ) -> tuple [dict [str , Any ], dict [str , Any ]]:
848850 """
849851 Helper method to create and return the anywidget mimebundle.
850852 This function encapsulates the logic for anywidget display.
851853 """
852854 from bigframes import display
853855
854- # TODO(shuowei): Keep blob_cols and pass them to TableWidget so that they can render properly.
855- df , _ = self ._get_display_df_and_blob_cols ()
856+ df , blob_cols = self ._get_display_df_and_blob_cols ()
856857
857858 # Create and display the widget
858859 widget = display .TableWidget (df )
@@ -863,22 +864,25 @@ def _get_anywidget_bundle(self, include=None, exclude=None):
863864 widget_repr , widget_metadata = widget_repr_result
864865 else :
865866 widget_repr = widget_repr_result
866- widget_metadata = None
867+ widget_metadata = {}
867868
868869 widget_repr = dict (widget_repr )
869870
870871 # At this point, we have already executed the query as part of the
871872 # widget construction. Let's use the information available to render
872873 # the HTML and plain text versions.
873- widget_repr ["text/html" ] = widget .table_html
874+ widget_repr ["text/html" ] = self ._create_html_representation (
875+ widget ._cached_data ,
876+ widget .row_count ,
877+ len (self .columns ),
878+ blob_cols ,
879+ )
874880
875881 widget_repr ["text/plain" ] = self ._create_text_representation (
876882 widget ._cached_data , widget .row_count
877883 )
878884
879- if widget_metadata is not None :
880- return widget_repr , widget_metadata
881- return widget_repr
885+ return widget_repr , widget_metadata
882886
883887 def _create_text_representation (
884888 self , pandas_df : pandas .DataFrame , total_rows : typing .Optional [int ]
0 commit comments