Commit 93d144f
Fix column width issues in grid state persistence 20.1.x (#16916)
* fix(state): 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>
* test(state): 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>
* test(*): update column-hiding test to reflect correct behavior
- 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>
* chore(*): 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(state): 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: hanastasov <14248932+hanastasov@users.noreply.github.com>1 parent 2926947 commit 93d144f
5 files changed
Lines changed: 91 additions & 12 deletions
File tree
- projects/igniteui-angular/src/lib/grids
- grid
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6832 | 6832 | | |
6833 | 6833 | | |
6834 | 6834 | | |
6835 | | - | |
| 6835 | + | |
| 6836 | + | |
| 6837 | + | |
| 6838 | + | |
| 6839 | + | |
| 6840 | + | |
| 6841 | + | |
6836 | 6842 | | |
6837 | 6843 | | |
6838 | 6844 | | |
6839 | 6845 | | |
6840 | 6846 | | |
6841 | 6847 | | |
| 6848 | + | |
| 6849 | + | |
| 6850 | + | |
| 6851 | + | |
| 6852 | + | |
6842 | 6853 | | |
6843 | | - | |
| 6854 | + | |
6844 | 6855 | | |
6845 | 6856 | | |
6846 | 6857 | | |
6847 | 6858 | | |
6848 | 6859 | | |
6849 | 6860 | | |
6850 | 6861 | | |
6851 | | - | |
6852 | 6862 | | |
6853 | 6863 | | |
6854 | 6864 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| 540 | + | |
| 541 | + | |
540 | 542 | | |
541 | | - | |
| 543 | + | |
542 | 544 | | |
543 | 545 | | |
544 | 546 | | |
| |||
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
234 | 249 | | |
235 | 250 | | |
236 | 251 | | |
| |||
247 | 262 | | |
248 | 263 | | |
249 | 264 | | |
250 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
251 | 268 | | |
252 | 269 | | |
253 | 270 | | |
| |||
264 | 281 | | |
265 | 282 | | |
266 | 283 | | |
267 | | - | |
| 284 | + | |
| 285 | + | |
268 | 286 | | |
269 | 287 | | |
270 | 288 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
| 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 | + | |
802 | 851 | | |
803 | 852 | | |
804 | 853 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments