infolist not woking?

I am using infolist on a custom page but the model is not loading. Page
class AccountStatements extends Page implements HasForms, HasTable, HasInfolists
{
use InteractsWithForms;
use InteractsWithTable;
use InteractsWithInfolists;

protected static ?string $navigationIcon = 'heroicon-o-cog-8-tooth';

protected static ?string $navigationGroup = 'Reports';

protected static string $view = 'filament.pages.reports.accountStatement';

protected $listeners = [
'update_table' => '$refresh',
];

public $account = null;

public function table(Table $table): Table
{

return $table
->query(ModelAccountStatement::queryAccount($this->account))
->columns([
TextColumn::make('transaction_no')->sortable(false),
// more data
])->filters([
SelectFilter::make('account')
->searchable(true)
->options(Account::query()->pluck('name', 'id')->toArray())
->columnSpan(2)
->query(
function ($data) {

if ($data['value'] != $this->account) {
$this->account = $data['value'];
$this->dispatch('update_table');
}

return null;
}
),

], layout: FiltersLayout::AboveContent)

->actions([
Tables\Actions\ViewAction::make(),

])
->emptyStateActions([]);
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('transaction_no'),
// more data
]);
}
}
class AccountStatements extends Page implements HasForms, HasTable, HasInfolists
{
use InteractsWithForms;
use InteractsWithTable;
use InteractsWithInfolists;

protected static ?string $navigationIcon = 'heroicon-o-cog-8-tooth';

protected static ?string $navigationGroup = 'Reports';

protected static string $view = 'filament.pages.reports.accountStatement';

protected $listeners = [
'update_table' => '$refresh',
];

public $account = null;

public function table(Table $table): Table
{

return $table
->query(ModelAccountStatement::queryAccount($this->account))
->columns([
TextColumn::make('transaction_no')->sortable(false),
// more data
])->filters([
SelectFilter::make('account')
->searchable(true)
->options(Account::query()->pluck('name', 'id')->toArray())
->columnSpan(2)
->query(
function ($data) {

if ($data['value'] != $this->account) {
$this->account = $data['value'];
$this->dispatch('update_table');
}

return null;
}
),

], layout: FiltersLayout::AboveContent)

->actions([
Tables\Actions\ViewAction::make(),

])
->emptyStateActions([]);
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('transaction_no'),
// more data
]);
}
}
No description
18 Replies
waleedGRT
waleedGRT10mo ago
🧐
waleedGRT
waleedGRT10mo ago
Anyone around?
waleedGRT
waleedGRT10mo ago
I believe this guide is for opening views in separate pages; however, I am attempting to open this in the model.
Vp
Vp10mo ago
In demo they display infolist.. check their demo git and you can have an idea, ref https://github.com/filamentphp/demo/blob/main/app/Filament/Resources/Blog/PostResource.php#L196
waleedGRT
waleedGRT10mo ago
Nope, this link you shared is for resource however I am using it on custom page
Vp
Vp10mo ago
Look this, they display in modal. Resource and custom page should not be much different https://github.com/filamentphp/demo/blob/main/app/Filament/Resources/Blog/CategoryResource.php#L93
waleedGRT
waleedGRT10mo ago
I tried almost same thing, but same result.😢
No description
waleedGRT
waleedGRT10mo ago
Is there anyone else who can assist me in resolving this issue?
Patrick Boivin
Patrick Boivin10mo ago
Where should the infolist appear in your example?
waleedGRT
waleedGRT10mo ago
See the code and gif above
Patrick Boivin
Patrick Boivin10mo ago
Can you to explain where you want the infolist to appear? I don't see any infolist in your gif.
waleedGRT
waleedGRT10mo ago
I want data to appear in the model like this, and I hope you understand what I mean.
No description
Patrick Boivin
Patrick Boivin10mo ago
Thanks, I understand now I see 2 things... 1. the modal doesn't work with your ViewAction 2. the infolist doesn't really belong on the Page class, it will be inside of the action
waleedGRT
waleedGRT10mo ago
So, what should i do?
Patrick Boivin
Patrick Boivin10mo ago
Make the modal work, then add the infolist to the modal Can you get a ViewModal working with regular form fields? Maybe I got 2. wrong... let me do a quick test Ok got it So you're right, this is a bit different because you're inside of a custom page (and not a resource class) I think all you need is to move the infolist entries on the ViewAction instead of the page class:
ViewAction::make()
->infolist([
TextEntry::make('title'),
// ...
]),
ViewAction::make()
->infolist([
TextEntry::make('title'),
// ...
]),
waleedGRT
waleedGRT10mo ago
Working now, many thanks for your assistance.
Want results from more Discord servers?
Add your server
More Posts