Overview
TheTextColumn displays text-based data from your database. It’s the most common column type and includes support for sorting, searching, and custom formatting.
Creating a Text Column
Basic Usage
Factory Method
You can also create text columns using the baseColumn class:
Without Field Binding
Create computed columns that don’t map to a database field:Common Methods
All methods return the column instance for fluent chaining.Set a custom label for the column header. If not specified, the label is automatically generated from the field name.
Enable sorting on this column.
Enable searching on this column. Accepts an optional field name for join columns or a custom closure for advanced search logic.
Format the cell value. Accepts a sprintf-style format string or a closure.
Completely customize the cell content. This takes precedence over
format(). The closure receives the model instance and optionally the table component.Set the column width using any CSS width value.
Hide the column from display.
Conditionally hide the column based on a boolean condition.
Apply CSS classes to both the header and cell for this column.
Apply CSS classes only to the column header.
Apply CSS classes only to the column cells.
Set a unique key for the column. Useful when using multiple columns with the same field.
Specify a SQL alias for the select statement. Useful for computed columns or aggregates.
Use a custom Blade view to render the cell.
Examples
Basic Text Column
Formatted Price Column
Computed Full Name Column
Join Column with Custom Search
Status Badge with Styling
Conditional Formatting
Truncated Text with Tooltip
Field Name Resolution
When using dotted field names (for relationships), the label is automatically derived from the last segment:brands.name→brands_nameorders.unit_price→orders_unit_price