How can I add an extra row in the table <head> #1574
Replies: 2 comments
-
Hi @andrewdrake, While this might not be the "most elegant" solution ever, you could use Personalizing Header & Footer - Include View to render a view on the Header's bottom area. In this view, you can render another element displaying the data you need. I quickly did an example with a table header as a POC. For example: PowerGrid: // app/Livewire/MyTable.php
class MyTable extends PowerGridComponent
{
public function setUp(): array
{
return [
Header::make()
->includeViewOnBottom('my-custom-view'),
];
} Blade View Example // resources/view/my-custom-view.blade.php
<table id="table_base_default" class="table power-grid-table min-w-full dark:!bg-primary-800">
<thead class="shadow-sm rounded-t-lg bg-gray-200 dark:bg-pg-primary-900">
<tr class="">
<th class="font-extrabold px-2 pr-4 py-3 text-left text-xs text-pg-primary-700 tracking-wider whitespace-nowrap dark:text-pg-primary-300 text-center" colspan="3">
<span>Personal Info</span>
</th>
<th class="font-extrabold px-2 pr-4 py-3 text-left text-xs text-pg-primary-700 tracking-wider whitespace-nowrap dark:text-pg-primary-300 " x-multisort-shift-click="3ZnB7uz3911JElzUknk7" wire:click="sortBy('created_at')" style="; width: max-content; cursor:pointer; ">
<div class="flex gap-2 select-none flex items-center gap-2">
<span>Creation Info</span>
</div>
</th>
</tr>
</thead>
</table> |
Beta Was this translation helpful? Give feedback.
-
I'm not sure that would work very well, as the columns would get out of alignment. I think until there is a method to add a row to the table head (😄 ) I'll just create a custom view for the table and add manually. |
Beta Was this translation helpful? Give feedback.
-
I have searched through the docs and couldn't find an easy solution for this, adding an extra row in the head of the table.
See this example:
Beta Was this translation helpful? Give feedback.
All reactions