Skip to content

Commit

Permalink
Update 2023-03-21-tables.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jS5t3r authored Nov 4, 2024
1 parent 9b58d36 commit c53f899
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions _posts/2023-03-21-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,19 @@ Below, you'll find the comprehensive paper list. I've also provided [JSON](https
<thead>
<tr class="tr-class-1">
<th data-field="date" data-sortable="true" data-width="50">date</th>
<th data-field="title" data-sortable="true" >title</th>
<th data-field="title" data-sortable="true" data-formatter="addLink">title</th>
<th data-field="author" data-sortable="true" >author(s)</th>
</tr>
</thead>
</table>

<script>
document.addEventListener("DOMContentLoaded", function() {
var rows = document.getElementById('link').getElementsByTagName('tbody')[0].rows;
Array.from(rows).forEach(row => {
row.addEventListener("click", function() {
console.log(this.getAttribute('data-href'));
// Uncomment the line below to navigate to the link when a row is clicked
// window.location.href = this.getAttribute('data-href');
});
});
});
function addLink(value, row) {
// Access the 'link' property directly from the row object
var link = row.link;
// Create an anchor tag with the link and value
return `<a href="${link}" target="_blank">${value}</a>`;
}
</script>

## Acknowledgment
Expand Down

0 comments on commit c53f899

Please sign in to comment.