DataTables with Livewire Integration #2538
Replies: 4 comments 6 replies
-
If you want datatables on livewire, maybe is better to go with https://livewire-datatables.com/ |
Beta Was this translation helpful? Give feedback.
-
Here is an example of a VideosDataTable public function dataTable($query)
{
return datatables()
->eloquent($query)
->addColumn('status', function (Video $video) {
return Livewire::mount('video-sync-poll', ['video' => $video])->html();
})
->rawColumns(['status'])
->setRowId('id');
}
public function html()
{
return $this->builder()
->setTableId('videos-table')
->columns($this->getColumns())
->minifiedAjax()
->drawCallbackWithLivewire() // enable livewire integration
->orderBy(3, 'asc')
->selectStyleOS()
->selectSelector('td:first-child')
->buttons([
SearchPanesButton::make(),
CreateButton::make(),
EditButton::make(),
RemoveButton::make(),
ReloadButton::make(),
])
->editors([
Editor::make()
->fields([
Text::make('video_id'),
Text::make('title'),
Select2::make('tags')
->data('tags[].name')
->label('Tags')
->opts([
'multiple' => true,
])
->modelOptions(Tag::class, 'name', 'name'),
]),
]);
} Livewire Componentclass VideoSyncPoll extends Component
{
public $video;
public function mount($video)
{
$this->video = $video;
}
public function render()
{
return view('livewire.video-sync-poll');
}
} |
Beta Was this translation helpful? Give feedback.
-
can we use ->render() method inside livewire render() ? |
Beta Was this translation helpful? Give feedback.
-
public function render(FaqsDataTable $dataTable) error""render" method on [App\Http\Livewire\Admin\Faq\Index] must return instance of [Illuminate\View\View]" please tell me what i am doing wrong during integration of yajra datatable in livewire |
Beta Was this translation helpful? Give feedback.
-
Hi everyone I am new in laravel, I'm still learning laravel and i want to learn laravel-livewire and integrate yajra datatables is their any sample project or documents you can refer for me in integrating yajra
Beta Was this translation helpful? Give feedback.
All reactions