mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-28 20:56:54 -06:00
The engine's live filter state is always sheet.autofilter — apply_filter, filter_values, clear_filter, reapply and the slicer command all read and write it, and a table's header dropdown installs one over the table's own range — while Table::filter is only ever filled by the reader. Writing suppressed the sheet <autoFilter> whenever any table merely intersected it and wrote the table part from Table::filter, which was empty: a filtered table saved with its rows still hidden and no criteria anywhere, so on reopen there was no filter to clear and Excel showed an inactive filter over mysteriously hidden rows. A slicer's selection was lost the same way. Fold the coinciding sheet filter's criteria into the table part (colId offsets are relative to the range's first column, and both ranges start at the same column, so they carry over verbatim); a filter that only partially covers a table still has nowhere valid to go and keeps being suppressed. Regression test: a_table_filter_criteria_survive_a_round_trip — on main the table part carries no criteria after a save; with the fold they round trip, the hidden row stays, and the sheet keeps no duplicate autoFilter.