File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -2220,7 +2220,8 @@ def on_bind(self) -> None:
22202220 bind_member (self , name = 'bulk_container' )
22212221
22222222 def get_visible_rows (self ):
2223- self .visible_rows = self .parts .page .rows
2223+ if self .visible_rows is None :
2224+ self .visible_rows = list (self .parts .page .rows )
22242225 return self .visible_rows
22252226
22262227 def _bind_query (self ):
@@ -2280,7 +2281,6 @@ def render_actions(self):
22802281 def _prepare_auto_rowspan (self ):
22812282 auto_rowspan_columns = [column for column in values (self .columns ) if column .auto_rowspan ]
22822283 if auto_rowspan_columns :
2283- self .visible_rows = list (self .get_visible_rows ())
22842284 no_value_set = object ()
22852285 for column in auto_rowspan_columns :
22862286 if column .cell .attrs .get ('rowspan' , no_value_set ) is not no_value_set :
Original file line number Diff line number Diff line change @@ -4468,3 +4468,34 @@ def test_annotate_on_broken_filters():
44684468 </tbody>
44694469 """ ,
44704470 )
4471+
4472+
4473+ def test_auto_rowspan_and_render_twice_generator (NoSortTable ): # noqa: N803
4474+ class TestTable (NoSortTable ):
4475+ foo = Column (auto_rowspan = True )
4476+
4477+ rows = [
4478+ Struct (foo = 1 ),
4479+ Struct (foo = 1 ),
4480+ Struct (foo = 2 ),
4481+ Struct (foo = 2 ),
4482+ ]
4483+
4484+ # language=html
4485+ expected_html = """
4486+ <table class="table" >
4487+ <thead>
4488+ <tr> <th class="first_column subheader"> Foo </th> </tr>
4489+ </thead>
4490+ <tbody>
4491+ <tr> <td rowspan="2"> 1 </td> </tr>
4492+ <tr> <td style="display: none"> 1 </td> </tr>
4493+ <tr> <td rowspan="2"> 2 </td> </tr>
4494+ <tr> <td style="display: none"> 2 </td> </tr>
4495+ </tbody>
4496+ </table>"""
4497+
4498+ t = TestTable (rows = (x for x in rows ))
4499+ t = t .bind (request = req ('get' ))
4500+ verify_table_html (table = t , expected_html = expected_html )
4501+ verify_table_html (table = t , expected_html = expected_html )
You can’t perform that action at this time.
0 commit comments