Building table rows with child components breaks table striping
See original GitHub issueUsing a parent table component and creating table rows out of child components results in alternating table_row and script tags like so:
<tr unicorn:id="3gyuTizE:payment-row:56" unicorn:name="payment-row" unicorn:key="56" unicorn:checksum="GnYyQM78">
...
</tr>
<script type="module">if (typeof Unicorn === 'undefined') { console.error('Unicorn is missing. Do you need {% load unicorn %} or {% unicorn-scripts %}?') } else { Unicorn.componentInit({"id":"3gyuTizE:payment-row:56",...}</script>
This breaks table striping as implemented in many css frameworks (tested with Bulma, Materialize, Picnic and Siimple). Using plain css as below also does not work properly b/c of the additional script tags after every row:
tr:nth-child(even) {
background-color: #F3F4F6;
}
tr:nth-child(odd) {
background-color: #aeb2bb;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Angular child component breaks table - Stack Overflow
This is a side effect of tables being rigid in structure. You can get around this by using the component as an attribute...
Read more >Zebra Striping Tables With CSS3 - Opera
Zebra striping—or, coloring or shading alternate rows on a table—is thought to enhance the usability of a table by guiding the user's eye ......
Read more >Building a Data Table Component in React — Development
Here's how to create a stripped down version of the data table we built for Polaris using React (note: This post requires polaris-react....
Read more >Creating Zebra-Striped Tables - the new code
This is an entirely appropriate use of a table: the concert dates are truly tabular data, with relevant, related information in each row....
Read more >Accessible, Simple, Responsive Tables | CSS-Tricks
Will break any unique IDs inside a table. Poor idea for Styleguide driven components. Using normal table markup and JavaScript at a breakpoint ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks! Just updated and seems to work as expected!
Awesome! Yes, it would solve the issue. I also agree that it would be cleaner not to output a script tag for each child component.
BTW, great work on django-unicorn! I’m excited to try it out on a couple new projects. Thanks for the hard work!