Commit 2985131
Fix column width issues in grid state persistence (#16901)
* Initial plan
* Fix column width issue when all columns are hidden in grid state
- Prevent setting _columnWidth to "0px" when all columns are hidden
- Preserve valid column widths for when columns are unhidden
- Add test to verify column widths are preserved after state restoration
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* Update test to properly validate column width preservation
- Adjust test expectations to handle columns constrained by minWidth
- Verify that columns don't all end up with the same minimum width
- Test passes successfully
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* Update column-hiding test to reflect correct behavior
- Update test expectation - column width should not be 0px when all columns hidden
- This allows proper width restoration when columns are unhidden
- All column hiding tests pass successfully
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* Address code review feedback
- Use explicit check for '0px' instead of parseFloat for clarity
- Remove hardcoded width assertion in test for better maintainability
- All tests still pass successfully
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* Refactor to eliminate code duplication
- Extract _updateColumnDefaultWidths helper method
- Remove redundant condition check
- Improve code maintainability
- All tests still pass
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* Fix: Only persist user-set column widths in grid state
- Only save width to state if widthSetByUser or columnWidthSetByUser is true
- Prevents auto-calculated widths from becoming fixed after state restore
- Handle width restoration to skip if undefined
- All tests pass
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
* test(pivot grid state): fixing test to not persist calculated column width
* refactor: Extract duplicated width restoration logic into helper method
- Extract restoreColumnState helper to avoid code duplication
- Handles width extraction, assignment, and conditional restoration
- Used for both column groups and regular columns
- All tests pass
Co-authored-by: hanastasov <14248932+hanastasov@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kdinev <1472513+kdinev@users.noreply.github.com>
Co-authored-by: Konstantin Dinev <kdinev@infragistics.com>
Co-authored-by: hanastasov <14248932+hanastasov@users.noreply.github.com>
Co-authored-by: Hristo Anastasov <hanastasov@infragistics.com>1 parent 4dd351e commit 2985131
5 files changed
Lines changed: 91 additions & 12 deletions
File tree
- projects/igniteui-angular/grids
- core/src
- grid/src
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
229 | 244 | | |
230 | 245 | | |
231 | 246 | | |
| |||
242 | 257 | | |
243 | 258 | | |
244 | 259 | | |
245 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
246 | 263 | | |
247 | 264 | | |
248 | 265 | | |
| |||
259 | 276 | | |
260 | 277 | | |
261 | 278 | | |
262 | | - | |
| 279 | + | |
| 280 | + | |
263 | 281 | | |
264 | 282 | | |
265 | 283 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
805 | 854 | | |
806 | 855 | | |
807 | 856 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
| 539 | + | |
| 540 | + | |
539 | 541 | | |
540 | | - | |
| 542 | + | |
541 | 543 | | |
542 | 544 | | |
543 | 545 | | |
| |||
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6796 | 6796 | | |
6797 | 6797 | | |
6798 | 6798 | | |
6799 | | - | |
| 6799 | + | |
| 6800 | + | |
| 6801 | + | |
| 6802 | + | |
| 6803 | + | |
| 6804 | + | |
| 6805 | + | |
6800 | 6806 | | |
6801 | 6807 | | |
6802 | 6808 | | |
6803 | 6809 | | |
6804 | 6810 | | |
6805 | 6811 | | |
| 6812 | + | |
| 6813 | + | |
| 6814 | + | |
| 6815 | + | |
| 6816 | + | |
6806 | 6817 | | |
6807 | | - | |
| 6818 | + | |
6808 | 6819 | | |
6809 | 6820 | | |
6810 | 6821 | | |
6811 | 6822 | | |
6812 | 6823 | | |
6813 | 6824 | | |
6814 | 6825 | | |
6815 | | - | |
6816 | 6826 | | |
6817 | 6827 | | |
6818 | 6828 | | |
| |||
0 commit comments