Overview
TheBooleanColumn displays boolean (true/false) values with customizable text labels. By default, it shows “Yes” for true and “No” for false.
Creating a Boolean Column
Basic Usage
Factory Method
You can also create boolean columns using the baseColumn class:
Boolean-Specific Methods
Customize the text displayed for true and false values.
Common Methods
Boolean columns support all common column methods:Set a custom label for the column header.
Enable sorting on this column.
Enable searching on this column. You can pass a custom field name or search callback.
Apply custom formatting to the boolean value. The closure receives the boolean value and the row model.
Completely customize the cell content. This takes precedence over both
labels() and format().Set the column width.
Apply CSS classes to both header and cells.
Apply CSS classes only to the column header.
Apply CSS classes only to the column cells.
Hide the column from display.
Conditionally hide the column.
Examples
Basic Active Status
Centered Boolean Column
Boolean with Custom Styling
Multiple Boolean Columns
Boolean with Icons
Boolean with Conditional Row Styling
Boolean Toggle Appearance
Resolution
TheBooleanColumn uses the base Column::resolveValue() method with custom logic:
- If a
render()callback is set, it’s used first - If a
format()callback is set, it receives the boolean value - Otherwise, the value is evaluated and returns either
$trueLabelor$falseLabel
Type
The column type identifier forBooleanColumn is 'boolean'.