Replies: 9 comments 6 replies
-
Would be great to see a repro in something like webcomponents.dev to have a better idea as to what you’re up to here. |
Beta Was this translation helpful? Give feedback.
-
Interestingly, I accidentally rendered it outside the sp-theme tag at c5d71fb352 and the bug with the display of the header does not surface when not subject to sp-theme. As soon as I put the sp-table back inside the sp-theme, the header stopped being constrained by the size of the table again. |
Beta Was this translation helpful? Give feedback.
-
in 70c64fc61 I finally got it to render using the items attribute and the renderItems api. It required some sideways thinking to understand what I was doing wrong, but eventually I realized that while I am extending Table, for the purposes of rendering, I have a Table, I am not a Table. I need to call renderItems from the child table. That's line 156 of projects/web/lib/components/mayor_table.ts |
Beta Was this translation helpful? Give feedback.
-
I am still having a lot of trouble with this. in 552736406e I have constrained everything to the same size, but nothing is at all aligned. each row has its own independent spacing, so the result is confusing rather than informative. I've got some temporary colors in place to help prove to myself that the CSS is in fact reaching the components, as I'm also a bit confused about the CSS interaction with the children of the top level table. It is treating the body and the header differently and I don't understand why yet. that's not necessarily related though because even different rows in the body of the table aren't aligned to each other. Is there a way to force it to use the same column sizes in every row? |
Beta Was this translation helpful? Give feedback.
-
okay, so I found the css for that table in ./projects/documentation/src/components/styles.css tonight.
the contents of the body magically started to align. I already had
which turns the text in the header sideways and gives me more space to work with. Adding
to the block controlling both header and body cells got rid of a horizontal scroll bar on the table header. I'm not quite sure which bit of css changed them from an overflow to the horizontal scroll bar. I do know that when the header changed to a scroll bar, the body started squishing differently. Its hard to describe the difference in behavior. The labels in the header still do not line up with the columns they are headers for. Still your advice to look at that file was immensely helpful and I feel much closer to the solution than I was. This screenshot shows the browser page small enough to show the remaining problem with the header alignment. |
Beta Was this translation helpful? Give feedback.
-
I am curious about one thing I see that you all did with the tables on the website. You put them in a div with class table-container and then set the margins of that div to negative , Then to compensate for that, you put a corresponding positive padding of --spectrum-global-dimension-size-700 on the table itself. Why do that? I'm sure there is a reason that is beyond my current level to grok. |
Beta Was this translation helpful? Give feedback.
-
Interestingly your table doesn't do this. Shrink yours down and first a few other things (like the side bar) disappear, then keep shrinking the browser window and eventually the table starts to simply get cut off on the right instead of continuing to squish. I haven't figured out where in the CSS this is controlled. So it is clearly something I'm doing, or rather, not doing. |
Beta Was this translation helpful? Give feedback.
-
So after continued comparison to your site, I came up with 208d4cbb0 which is probably good enough. I am still curious about the negative margin and padding offset. I copied it, despite not understanding it on the theory that wiser heads than I put it in place. Thanks again for the direction. |
Beta Was this translation helpful? Give feedback.
-
updates to the sp-table component have largely fixed the issues I was having. |
Beta Was this translation helpful? Give feedback.
-
I am trying to extend sp-table to take a data source with the virtual items, currently a csv file hosted in the same s3 bucket as the site. I'm having trouble translating the examples given that use a script on the html page consuming the element into how a lit element extending sp-table could update the items attribute to create the rows. An example that used this within another web component instead of manipulating it from a script would be greatly appreciated.
Right now I have
and am getting a linting error that
Type '(item: Record<string, unknown>, index: number) => TableCell[]' is not assignable to type '(item: Record<string, unknown>, index: number) => TemplateResult' on the t.renderItem = line. Both my code and the example code on the website return an array of TableCell, I am beginning to believe that the example code on the documentation site wouldn't work.
Beta Was this translation helpful? Give feedback.
All reactions