trait Columns

Properties

string $column_id

The unique identifier column for rows.

string $custom_column_id

A custom column ID override.

Collection|null $columns

Collection of defined columns.

bool $show_column_toggle

Whether to show the column toggle dropdown.

bool $column_toggle_dd_status

Status of the column toggle dropdown (open/closed).

bool $hasMobileCollapsedColumns

Indicates if there are columns collapsed on mobile view.

array $mobileCollapsedColumns

Array of columns that are collapsed on mobile.

Methods

void
setColumns()

Initialize and process column definitions.

Collection
getFreshColumns()

Get a fresh collection of column instances with closures intact.

array
resolveSecondaryHeaders(mixed $paginatedData)

Resolve secondary header values by calling each column's callback with the current rows.

void
showColumnToggle(bool $bool)

Show or hide the column toggle dropdown.

void
setColumnID(string $column_id)

Set the primary key column used to identify rows.

hideOnMobile(bool $bool)

Hide this column on mobile devices.

showOnMobile(bool $bool = true)

Show this column only on mobile devices.

view(string $view)

Set a custom Blade view for rendering the column cell.

styling(string $classes)

Set CSS classes for the column's table cell (td).

thStyling(string $classes)

Set CSS classes for the column's table header (th).

thWrapperStyling(string $classes)

Set CSS classes for the column's header wrapper element.

disableToggleWhen(Closure $function)

Set a closure that determines when the toggle should be disabled.

hideToggleWhen(Closure $function)

Set a closure that determines when the toggle should be hidden.

trigger(string $trigger)

Set the method name to call when a toggle column is toggled.

isBool()

Mark this column as a boolean column.

trueIs(mixed $true)

Set the value that represents "true" for boolean columns.

trueLabel(string $string)

Set the display label/icon for the "true" state.

falseLabel(string $string)

Set the display label/icon for the "false" state.

toHtml()

Allow the column value to be rendered as raw HTML.

text(string $text)

Set the display text for a link column.

href(Closure $function)

Set a closure that resolves the URL for a link column.

target(string $target)

Set the target attribute for a link column (e.g. '_blank').

popup(array $array = ['width' => 750, 'height' => 800])

Open the link in a popup window with the given dimensions.

classes(string $classes)

Set CSS classes for a link column's anchor tag.

customData(Closure $function)

Set a closure to transform the column's display value.

hideWhen(bool $bool)

Conditionally hide the column and remove it from the column selector.

hideFromSelector(bool $bool)

Hide this column from the column toggle selector.

isVisible(bool $bool)

Set the column's initial visibility.

sortColumnBy(string $column)

Set an alternative column key to use when sorting this column.

Details

at line 53
void setColumns()

Initialize and process column definitions.

Handles mobile visibility, collapse behavior, and strips closures for Livewire serialization.

Return Value

void

at line 99
Collection getFreshColumns()

Get a fresh collection of column instances with closures intact.

Return Value

Collection

at line 114
array resolveSecondaryHeaders(mixed $paginatedData)

Resolve secondary header values by calling each column's callback with the current rows.

Parameters

mixed $paginatedData

Return Value

array

at line 136
void showColumnToggle(bool $bool)

Show or hide the column toggle dropdown.

Parameters

bool $bool

Return Value

void

at line 146
void setColumnID(string $column_id)

Set the primary key column used to identify rows.

Parameters

string $column_id

Return Value

void

at line 154
Columns hideOnMobile(bool $bool)

Hide this column on mobile devices.

Parameters

bool $bool

Return Value

Columns

at line 164
Columns showOnMobile(bool $bool = true)

Show this column only on mobile devices.

Parameters

bool $bool

Return Value

Columns

at line 176
Columns view(string $view)

Set a custom Blade view for rendering the column cell.

Parameters

string $view

Return Value

Columns

at line 187
Columns styling(string $classes)

Set CSS classes for the column's table cell (td).

Parameters

string $classes

Return Value

Columns

at line 197
Columns thStyling(string $classes)

Set CSS classes for the column's table header (th).

Parameters

string $classes

Return Value

Columns

at line 207
Columns thWrapperStyling(string $classes)

Set CSS classes for the column's header wrapper element.

Parameters

string $classes

Return Value

Columns

at line 217
Columns disableToggleWhen(Closure $function)

Set a closure that determines when the toggle should be disabled.

Parameters

Closure $function

Return Value

Columns

at line 227
Columns hideToggleWhen(Closure $function)

Set a closure that determines when the toggle should be hidden.

Parameters

Closure $function

Return Value

Columns

at line 237
Columns trigger(string $trigger)

Set the method name to call when a toggle column is toggled.

Parameters

string $trigger

Return Value

Columns

at line 247
Columns isBool()

Mark this column as a boolean column.

Return Value

Columns

at line 259
Columns trueIs(mixed $true)

Set the value that represents "true" for boolean columns.

Parameters

mixed $true

Return Value

Columns

at line 271
Columns trueLabel(string $string)

Set the display label/icon for the "true" state.

Parameters

string $string

Return Value

Columns

at line 283
Columns falseLabel(string $string)

Set the display label/icon for the "false" state.

Parameters

string $string

Return Value

Columns

at line 293
Columns toHtml()

Allow the column value to be rendered as raw HTML.

Return Value

Columns

at line 305
Columns text(string $text)

Set the display text for a link column.

Parameters

string $text

Return Value

Columns

at line 317
Columns href(Closure $function)

Set a closure that resolves the URL for a link column.

Parameters

Closure $function

Return Value

Columns

at line 329
Columns target(string $target)

Set the target attribute for a link column (e.g. '_blank').

Parameters

string $target

Return Value

Columns

at line 343
Columns popup(array $array = ['width' => 750, 'height' => 800])

Open the link in a popup window with the given dimensions.

Parameters

array $array

Return Value

Columns

at line 357
Columns classes(string $classes)

Set CSS classes for a link column's anchor tag.

Parameters

string $classes

Return Value

Columns

at line 369
Columns customData(Closure $function)

Set a closure to transform the column's display value.

Parameters

Closure $function

Return Value

Columns

at line 379
Columns hideWhen(bool $bool)

Conditionally hide the column and remove it from the column selector.

Parameters

bool $bool

Return Value

Columns

at line 392
Columns hideFromSelector(bool $bool)

Hide this column from the column toggle selector.

Parameters

bool $bool

Return Value

Columns

at line 402
Columns isVisible(bool $bool)

Set the column's initial visibility.

Parameters

bool $bool

Return Value

Columns

at line 412
Columns sortColumnBy(string $column)

Set an alternative column key to use when sorting this column.

Parameters

string $column

Return Value

Columns