Added an example with two tables in the same parent component
This commit is contained in:
@@ -5,16 +5,36 @@ namespace App\Tables;
|
||||
use App\Models\Product;
|
||||
use App\Tables\Traits\WithColumnFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Mmt\GenericTable\Components\Column;
|
||||
use Mmt\GenericTable\Components\ColumnCollection;
|
||||
use Mmt\GenericTable\Enums\ColumnSettingFlags;
|
||||
use Mmt\GenericTable\Interfaces\IDragDropReordering;
|
||||
use Mmt\GenericTable\Interfaces\IGenericTable;
|
||||
use Mmt\GenericTable\Interfaces\ISingleSelectionFilter;
|
||||
use Mmt\GenericTable\Support\SelectionFilterSettings;
|
||||
|
||||
class TableWithDragDropOrdering implements IGenericTable, IDragDropReordering
|
||||
class TableWithDragDropOrdering implements IGenericTable, IDragDropReordering, ISingleSelectionFilter
|
||||
{
|
||||
use WithColumnFormatter;
|
||||
|
||||
public string $Order;
|
||||
|
||||
public Model|string $model = Product::class;
|
||||
|
||||
public ColumnCollection $columns;
|
||||
|
||||
public string $orderingColumn = 'order';
|
||||
|
||||
public SelectionFilterSettings $singleSelectionFilterSettings;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->columns = ColumnCollection::make(
|
||||
new Column('Id'),
|
||||
new Column('Name'),
|
||||
new Column('Description'),
|
||||
new Column('Price'),
|
||||
new Column('Stock'),
|
||||
new Column('Order')->withSettings(ColumnSettingFlags::DEFAULT_SORT_DESC)
|
||||
);
|
||||
|
||||
$this->singleSelectionFilterSettings = new SelectionFilterSettings('name');
|
||||
$this->singleSelectionFilterSettings->add('Make pop', 'ml');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user