LaraGrid
  • LaraGrid
  • Installation
  • Publishable
  • Usage
    • Base Usage
      • Create a Grid
      • Display a Grid
    • Examples
  • Theme
    • Default Theme
    • Customize the Theme
  • Column
    • Description
    • Create a Column
    • Methods
    • Usage
  • Column Group
    • Description
    • Create a ColumnGroup
    • Methods
    • Usage
  • Filter
    • Description
    • Available Filters
    • Usage
    • Custom Builder
    • Custom filter
    • Show filtering and sorting in url
  • Filter Reset Button
    • Description
    • Usage
    • Customization
  • Layout
    • Description
    • Usage
  • PowerJoins in LaraGrid
    • Why do we use it
Powered by GitBook
On this page

Was this helpful?

  1. Filter

Usage

Filters are used in the getColumns method of your Livewire component to define the filters for the columns in the grid. The filters are applied to the data source based on the user's input.

protected function getColumns(): array
{
    return [
        Column::make('id', 'ID'),
        Column::make('name', 'Name')->setFilter(TextFilter::make()),
        Column::make('status', 'Status')->setFilter(SelectFilter::make()->setOptions([
            'active' => 'Active',
            'inactive' => 'Inactive',
        ])),
        Column::make('created_at', 'Created At')->setFilter(DateFilter::make()),
        // Add more columns as needed
    ];
}
PreviousAvailable FiltersNextCustom Builder

Last updated 1 year ago

Was this helpful?