question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change HTML element of table.

See original GitHub issue

Can i change the HTML element of table, today is a <div>, i would to use <table> element, it is possible?

Same for other elements of react-table.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gary-menzelcommented, Mar 22, 2018

This requires a complete re-write of ReactTable due to Tanner’s original comment and the internal reliance on flexbox. It would also violate the original principal to make ReactTable page-based and mobile friendly. If a “real” HTML table is required, then ReactTable is probably not the right package or you might require some background “magic” to copy the data into a hidden table first and then copy to the clipboard from that (if it is possible).

1reaction
haukepribnowcommented, Mar 22, 2018

I was also looking for a way to replace the <div>s with “true” HTML table tags. My main intention was to allow the column structure to be kept intact when copying & pasting the grid content to Microsoft Excel (AFAIK without a true HTML table structure, Excel just puts all content into one single column instead of copying the two-dimensional structure successfully). Making the grids more accessible for screen readers and the such may be a relevant case for “true” HTML tags as well.

Too bad that the HTML specifications do not seem to offer nested <tbody> tags or some kind of “dummy” tag that could be used instead of the rt-tr-group <div>s. Judging from my short research, the other tags would match quite nicely:

  • rt-table = <table>
  • rt-thead = <thead>
  • rt-tr = <tr>
  • rt-resizable-header = <th class="resizable">
  • rt-td = <td>
  • rt-tfoot = <tfoot>
  • rt-tr-group = ??? (Here’s the core issue.)

Obviously, this would also require additional CSS to override the browser default styles for table elements with the styles that react-table requires in order to work.

Is there anything I missed that could violate HTML specifications except of the rt-tr-group mismatch?

Read more comments on GitHub >

github_iconTop Results From Across the Web

<table>: The Table element - HTML - MDN Web Docs - Mozilla
The <table> HTML element represents tabular data — that is, information presented in a two-dimensional table comprised of rows and columns ...
Read more >
HTML Tables: When to Use Them and How to Make & Edit Them
To make a table in HTML, use the <table> tag. Within this table tag, you'll place the <tr>, <th>, and <td> tags. The...
Read more >
CRUD in HTML, JavaScript, and jQuery - CODE Magazine
In this first article of a series on working within HTML and the Web API, I'll show you how to add, edit, and...
Read more >
Change table td using javascript - html - Stack Overflow
This works: Code snippet. Try this: function trans() { var table = document.getElementById("table"); var row = table.
Read more >
HTML Tables - W3Schools
Note: A table cell can contain all sorts of HTML elements: text, images, ... text in <th> elements are bold and centered, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found