how to stop table auto refresh when public properties updated in live wire component
i have a filament page and it has multiple public properties along with a table . but when i update these public property using ' wire:model.change ' then the table becomes auto refreshed why and how to fix this
6 Replies
can you share more about your situation? What are the properties that you use? we can't help without deep dive into the code
this is the blade file
<div>
<div>
<select wire:model.change="roleuser" id="countries">
<option value="super_admin" selected>Choose a Role</option>
<option value="admin">admin</option>
<option value="superadmin">superadmin</option>
<option value="staff">staff</option>
</select>
{{ $this->table }}
</div>
</div>
this is my php file
class Xyz extends Page implements HasTable
{
protected $listeners = ['refreshTable' => '$refresh'];
use InteractsWithTable {
makeTable as makeBaseTable;
}
use HasTabs;
protected static string $view = 'filament.pages.xyz';
protected static ?int $navigationSort = 3;
protected $contact;
public $roleuser ;
protected bool $loadTable=false;
public function updatedRoleuser ($value, $key) {
$this->dispatch("userRoleUpdation",$value);
}
protected function makeTable(): Table { info("make table method"); return $this->makeBaseTable() ->query(fn(): Builder => $this->getTableQuery()) ->modifyQueryUsing($this->modifyQueryWithActiveTab(...)) ->recordAction(fn(): string => 'view') ->paginated([150]); } public function view($record = null) { info("view"); $this->contactCard($record); } public function contactCard($conversationId) { xyz perform } public static function table(Table $table): Table { return $table ->query(Conversation::query()) ->columns([ TextColumn::make('contact.name')->weight('bold')->grow(false)->searchable()->extraAttributes(["class" => ""]) ]);
} } i have sent my blade file and php file and I need to ensure that when changing the roleUser property, it does not trigger an automatic table refresh in my Filament component
protected function makeTable(): Table { info("make table method"); return $this->makeBaseTable() ->query(fn(): Builder => $this->getTableQuery()) ->modifyQueryUsing($this->modifyQueryWithActiveTab(...)) ->recordAction(fn(): string => 'view') ->paginated([150]); } public function view($record = null) { info("view"); $this->contactCard($record); } public function contactCard($conversationId) { xyz perform } public static function table(Table $table): Table { return $table ->query(Conversation::query()) ->columns([ TextColumn::make('contact.name')->weight('bold')->grow(false)->searchable()->extraAttributes(["class" => ""]) ]);
} } i have sent my blade file and php file and I need to ensure that when changing the roleUser property, it does not trigger an automatic table refresh in my Filament component
that expected from livewire nature but you can stop auto refresh nature but wrapping your table portion with wire:ignore like so :
but initially it didn't fetch my table ..means my table is not showed in my ui .
your code means you have the
table
function in the livewire class and in the UI you have a livewire component that integrates with filament tables and you have the {{$this->table}}
so the table must be in your UI !Got it! The issue is solved.