Open stephane-klein opened 11 months ago
I'm working in this branch https://github.com/stephane-klein/svelte-headless-table/tree/issue-179
@bryanmylee
Ahh thanks for the report! I appreciate the help!
@bryanmylee more information in this screencast: https://youtu.be/HQ_AFzAjWFc
This screencast shows a svelte-headless-table
configured to use the addGridLayout and addHiddenColumns plugins together.
Here is the source code example page used in this screencast: https://github.com/stephane-klein/svelte-headless-table/blob/issue-179/src/routes/grid-layout-with-hidden/%2Bpage.svelte
First experience:
progress
, everything works fine πstatus
, everything works fine πA bug occurs if I hide a column that is not the last visible column, example, I execute :
age
column, then the bug is visible : the table cells are not correctly displayed πWhy? In html source code rendered, I see:
<tr ...>
<th style="grid-column: 1 / span 1;" ...>First Name</th>
<th style="grid-column: 3 / span 1;" ...>Age</th>
<th style="grid-column: 4 / span 1;" ...>Status</th>
<th style="grid-column: 5 / span 1;" ...>Visits</th>
<th style="grid-column: 6 / span 1;" ...>Profile Progress</th>
</tr>
I notice that the grid-column
value of Age
is 3
when it shoud be 2
.
Another observation:
progress
, visits
, status
visits
column, result : everything works fine π<tr ...>
<th style="grid-column: 1 / span 1;" ...>First Name</th>
<th style="grid-column: 2 / span 1;" ...>Last Name</th>
<th style="grid-column: 3 / span 1;" ...>Age</th>
<th style="grid-column: 4 / span 1;" ...>Visits</th>
</tr>
The grid-column
values are all correctly calculated.
For the moment, here's what I've deduced from these observations: the grid-column
values of columns positioned after the hidden column DOM node are not updated.
Updating grid-column
values works correctly if a column DOM node is inserted, whatever its position.
Why does this happen? For the moment, I don't know π€·π»ββοΈ.
Why does this happen? For the moment, I don't know π€·π»ββοΈ.
@bryanmylee When a column is hidden, this line is not executed for columns placed after the hidden column.
@bryanmylee I think the bug is fixed with this patch https://github.com/stephane-klein/svelte-headless-table/commit/4c4c72abfeae674272de51b0b27bcab4078e54a1
I will clean my commit and submit a merge request π.
I will clean my commit and submit a merge request π.
@bryanmylee cleaned commit : https://github.com/stephane-klein/svelte-headless-table/commit/0cea8b7b007f6b6e530bafe7fdb841ccf9393f55
Hi,
I just discovered that the addGridLayout isn't compatible with addHiddenColumns.
You can see the problem by trying to hide columns in this example: https://svelte.dev/repl/3c2e3375c82748c0941699e4f427c0a7?version=3.48.0
I think hidden columns are not taken into account when calculating the number of columns here.
I'll try to create a pull request to correct this issue π€.
Best regards,
StΓ©phane