You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you published the resource files and customized them? (php artisan vendor:publish)
Yes
What is the problem?
I was using PowerGrid v6.4.2 and my tables are working properly. I just updated it to latest version (v6.6.0) and my table is showing No Records found message, even though the footer is showing 1 to 1 of 1 results.
Code snippets
<?php
namespace App\Livewire\Company\AudioVideo\Podcast;
use App\Services\AudioVideoService;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Livewire\Attributes\On;
use PowerComponents\LivewirePowerGrid\Column;
use PowerComponents\LivewirePowerGrid\Components\SetUp\Exportable;
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
use PowerComponents\LivewirePowerGrid\PowerGridFields;
use PowerComponents\LivewirePowerGrid\Traits\WithExport;
final class ViewTable extends PowerGridComponent
{
use WithExport;
public $activeCompany;
public $activeCompanyData;
public $audioVideoService;
public $endDate;
public $id;
public $startDate;
public int $perPage = 50;
public string $rangeLabel;
public string $sortDirection = 'desc';
public string $sortField = 'published_at';
public string $tableName = 'podcast-table';
/**
* Constructor for the ViewTable component
*
* @return void
*/
public function __construct()
{
$this->startDate = today()->subMonths(config('app.default_period_range'))->format('Y-m-d');
$this->endDate = today()->format('Y-m-d');
}
/**
* Get the data for the table
*
* @return Collection
*/
public function datasource(): Collection
{
return $this->getPodcast();
}
/**
* Set up the table
*
* @return array
*/
public function setUp(): array
{
$companyName = $this->activeCompanyData['name'];
$today = Carbon::now()->format('Y-m-d');
return [
PowerGrid::exportable(fileName: $companyName . ' - Podcast - ' . $today)
->type(Exportable::TYPE_XLS, Exportable::TYPE_CSV),
PowerGrid::header()
->showSearchInput()
->showToggleColumns(),
PowerGrid::footer()
->showPerPage(perPage: $this->perPage, perPageValues: [5, 10, 25, 50, 100, 0])
->showRecordCount(),
];
}
/**
* Get the fields for the table
*
* @return PowerGridFields
*/
public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('id')
->add('title')
->add('published_at', function ($entry) {
return Carbon::parse($entry->published_at)->format('d M Y H:i:s');
})
->add('downloads');
}
/**
* Get the columns for the table
*
* @return array
*/
public function columns(): array
{
return [
Column::make('Title', 'title')
->contentClasses('text-wrap')
->searchable()
->sortable(),
Column::make('Date', 'published_at')
->sortable(),
Column::make('Downloads', 'downloads')
->contentClasses('text-right')
->sortable(),
// Column::action('Action')
];
}
/**
* Get the podcast data
*
* @return Collection
*/
public function getPodcast()
{
$avService = new AudioVideoService($this->activeCompany, $this->startDate, $this->endDate);
$podcast = $avService->getActiveCompanyPodcastEpisodes();
$data = $podcast->get()->toArray();
return collect($data);
}
/**
* Handle the date range change
*/
#[On('dateRangeChanged')]
public function handleDateRangeChange($range, $start, $end, $preset, $label)
{
$this->startDate = \Illuminate\Support\Carbon::parse($start)->format('Y-m-d');
$this->endDate = \Illuminate\Support\Carbon::parse($end)->format('Y-m-d');
$this->resetPage();
}
}
How do you expect it to work?
It should list all the entries just like it was with v6.4.2
Please confirm (incomplete submissions will not be addressed)
I have provided easy and step-by-step instructions to reproduce the bug.
I have provided code samples as text and NOT images.
I understand my bug report will be removed if I haven't met the criteria above.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Livewire PowerGrid version
v6.6.0
Livewire version
v3.6.4
Laravel version
v12.28.0
Which PHP version are you using?
PHP 8.4
Which Theme are you using?
Tailwind
Have you published the resource files and customized them? (php artisan vendor:publish)
Yes
What is the problem?
I was using PowerGrid v6.4.2 and my tables are working properly. I just updated it to latest version (v6.6.0) and my table is showing
No Records found
message, even though the footer is showing 1 to 1 of 1 results.Code snippets
How do you expect it to work?
It should list all the entries just like it was with v6.4.2
Please confirm (incomplete submissions will not be addressed)
Beta Was this translation helpful? Give feedback.
All reactions