PHP code example of team-nifty-gmbh / tall-datatables
1. Go to this page and download the library: Download team-nifty-gmbh/tall-datatables library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
team-nifty-gmbh / tall-datatables example snippets
> DataTableButton::make()
> ->label('Edit')
> ->icon('pencil')
> ->color('primary')
> ->attributes([
> 'x-on:click' => '$wire.edit(record.id); $event.stopPropagation()', // <--- here
> ]),
## Combining Columns
You can combine multiple columns into one by overwrite the get{Position}Appends.
As the name states the defined columns will be appended to the position.
protected function getBuilder(Builder $builder): Builder
{
return $builder->with('roles');
}
protected function getReturnKeys(): array
{
return array_merge(parent::getReturnKeys(), ['currency.iso']);
}
Broadcast::channel(\App\Models\User::getBroadcastChannel(), function ($user) {
return true;
});
use TeamNifty\TallDatatables\Traits\HasFrontendAttributes;
class User extends Authenticatable
{
use HasFrontendAttributes;
protected string $detailRouteName = 'users.id';
...
}
public function getDetailRouteParameters(): array
{
return [
'id' => $this->id,
'foo' => 'bar',
];
}
$user = User::first();
$user->href; // returns the detail route for the user
use TeamNiftyGmbH\DataTable\Htmlables\DataTableRowAttributes;
...
public function getRowAttributes(): array
{
return DataTableRowAttributes::make()
->bind('class', 'record.is_active ? \'bg-green-100\' : \'bg-red-100\'')
->on('click', 'alert($event.detail.record.id)')
->class('cursor-pointer')
}
public bool $hasInfiniteScroll = true;
public bool $showFilterInputs = true;
public bool $hasHeader = false;
protected string $iconName = 'user';
use TeamNifty\TallDatatables\Contracts\InteractsWithDataTables;
class User extends Authenticatable implements InteractsWithDataTables
{
...
public function getLabel(): string
{
return $this->name;
}
public function getDescription(): string
{
return $this->email;
}
}