Git Product home page Git Product logo

arm092 / livewire-datatables Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mediconesystems/livewire-datatables

25.0 25.0 11.0 983 KB

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS (Fork of MedicOneSystems/livewire-datatables but with updating dependencies and support new Laravel versions in time)

Home Page: https://livewire-datatables.com/

License: MIT License

PHP 72.37% Blade 27.63%

livewire-datatables's People

Contributors

3rgo avatar arm092 avatar chrisjimallen avatar code23-barna avatar creeppork avatar evici avatar hadrionic avatar hobiecat avatar laravel-shift avatar levi730 avatar marksalmon avatar mrsid18 avatar msalehipro avatar ousid avatar plassani avatar reganlyden avatar renardudezert avatar rickdubiel avatar rikthomas avatar schmeits avatar shaneburrell avatar spoyntersmith avatar stephenjude avatar tarekbazine avatar tedderouni avatar thyseus avatar tiagosimoesdev avatar tomshaw avatar trippo avatar waffshappen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

livewire-datatables's Issues

How to run in livewire v3

When running in laravel 10 and Livewire 3 I got this issue how to fix it..

Declaration of App\Livewire\CheckTable::builder() must be compatible with Arm092\LivewireDatatables\Livewire\LivewireDatatable::builder(): Illuminate\Database\Eloquent\Builder

use Arm092\LivewireDatatables\Livewire\LivewireDatatable;
use Arm092\LivewireDatatables\NumberColumn;
use Livewire\Component;
use Modules\AssignItem\Models\AssignItem;

class CheckTable extends LivewireDatatable
{
// public function render()
// {
// return view('livewire.check-table');
// }

public function builder()
{
    return AssignItem::query();
}

public function columns()
{
    return [
        NumberColumn::name('id')
        ->label('ID')
        ->filterable(),

    ];
}

} this is livewire class and in blade @livewire('check-table')

error when hitting export button on livewire-datatables

how to use $exportable function with columns from other tables?

<?php

namespace App\Livewire;

use App\Models\Employee;
use Arm092\LivewireDatatables\Column;
use Arm092\LivewireDatatables\Livewire\LivewireDatatable;
use Arm092\LivewireDatatables\NumberColumn;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

class EmployeesTable extends LivewireDatatable
{
    public string|null|Model $model = null;

    public bool $exportable = true;

    public function builder(): Builder
    {
        return Employee::query();
    }

    public function getColumns(): array|Model
    {
        return [
            NumberColumn::name('id')
                ->label('ID'),

            Column::name('first_name')
                ->defaultSort('asc')
                ->label('First Name')
                ->searchable(),

            Column::name('middle_name')
                ->label('Middle Name')
                ->searchable(),

            Column::name('last_name')
                ->label('Last Name')
                ->searchable(),

            Column::name('birthday')
                ->label('Birthday'),

            Column::name('address.line_address')
                ->label('Address')
                ->searchable(),

            Column::name('address.city.name')
                ->label('City')
                ->searchable(),

            Column::name('address.city.province.name')
                ->label('Province'),

            Column::callback(['id'], function ($id) {
                return view('employees.actions', ['id' => $id]);
            })->excludeFromExport(),
        ];
    }
}

and i have this error when export button and here is error logs if need them https://flareapp.io/share/x7XZkzVm i
image

$defaultSort must not be accessed before initialization

Hello, thanks for the fork.

Im trying configure it, but i got the following error.

https://flareapp.io/share/pPvK0L17

My Livewire Component:

<?php

namespace App\Livewire\Datatables\PartnerItem;

use App\Models\PartnerItem;
use Arm092\LivewireDatatables\Column;
use Arm092\LivewireDatatables\Livewire\LivewireDatatable;

class PartnerItemTable extends LivewireDatatable
{
    public $model = PartnerItem::class;

    public function columns(): array
    {
        return [
            Column::name('name')
        ];
    }
}

My test view

<livewire:datatable model="App\Models\PartnerItem" />

I made this change in the Column class and my table renders

    public bool|string $defaultSort = false;

Appreciate any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.