GridViewController

Grid View Controller - Simplified Architecture

This controller follows a clean MVC pattern where:

  • Server generates complete state
  • Templates display state
  • Controller captures user actions and navigates

NO state management in JavaScript - server is source of truth.

Supports optional bulk selection when enableBulkSelection is configured.

Constructor

new GridViewController()

Methods

applyColumnChanges()

Apply column changes (from modal)

applyDateRangeFilter()

Apply date range filter

applySort()

Apply sort to a column

buildUrl()

Build URL with updated parameters

buildUrlWithFilters()

Build URL with filter parameters

clearAllFilters()

Clear all filters and search (preserves locked filters)

clearBulkSelection()

Clear all bulk selections

(async) clearDefault()

Clear user default view

clearSearch()

Clear search

connect()

Initialize controller

createFilterPill(column, value, isLocked)

Create a filter pill element

Parameters:
NameTypeDefaultDescription
columnstring

The filter column key

valuestring

The filter value

isLockedbooleanfalse

Whether this filter is locked (cannot be removed)

createSearchBadge()

Create a search badge element

createViewTab(name, viewId, isActive, isPreferred, canManage, count)

Create a view tab element

Parameters:
NameTypeDefaultDescription
namestring

Tab name

viewIdstring | null

View ID (null for 'All' tab)

isActiveboolean

Is this the active tab

isPreferredboolean

Is this the preferred (default) view

canManageboolean

Can this view be managed

countnumber | nullnull

Optional count for badge display

(async) deleteView()

Delete current view

disconnect()

Cleanup when controller disconnects

escapeHtml()

Escape HTML for safe insertion

exportCsv()

Export current grid data to CSV

Triggers a CSV export with current filters, search, sort, and column selection. Uses the table frame's src URL as base (handles embedded grids with custom endpoints).

formatColumnName()

Format column name for display

getCsrfToken()

Get CSRF token from meta tag

getCurrentConfig()

Get current configuration for saving

getFilterColumnLabel()

Get filter column label from metadata

getFilterValueLabel()

Get filter value label from metadata

handleColumnReorder()

Handle column reorder from sortable list

handleFrameLoad()

Handle Turbo Frame load - update state from table frame

handleSearchKeyup()

Handle search input keyup with debouncing

isFilterLocked(column, lockedFilters) → {boolean}

Check if a filter column is locked

Parameters:
NameTypeDescription
columnstring

The filter column key

lockedFiltersArray.<string>

Array of locked filter keys

Returns:

True if the filter is locked

Type: 
boolean

loadInlineState()

Load state from inline rendered content (when table frame doesn't have src) This handles the case where grid content is pre-rendered on initial page load.

Navigate to URL via Turbo (frame or full page)

performSearch()

Perform search

removeFilter()

Remove a specific filter value

(async) saveView()

Save current state as new view

selectFilter()

Show specific filter panel in dropdown

(async) setDefault()

Set current view as user default

setSearchBusy()

Toggle search busy indicator in the filter search input.

showAll()

Show all records (clear view selection)

switchView()

Switch to a specific view

toggleAllSelection()

Toggle all row checkboxes on current page

toggleColumn()

Toggle column visibility (checkbox in modal)

toggleFilter()

Toggle a filter value

toggleRowSelection()

Toggle individual row selection checkbox

toggleSubRow(event)

Toggle sub-row expansion for additional details

Parameters:
NameTypeDescription
eventEvent

Click event from cell with toggleSubRow action

triggerBulkAction()

Trigger bulk action - dispatches event with selected IDs for modal listeners

updateBulkSelectionUI()

Update bulk action button state and selection count display

updateClearFiltersFooter()

Update clear filters footer visibility

updateColumnPicker()

Update column picker modal

updateDateRangeFilter()

Update date range filter value

updateFilterCount()

Update filter count badge

updateFilterDropdownCheckboxes()

Update filter dropdown checkboxes to match current state (This is now mostly redundant since we rebuild the panels, but keeping it for any dynamic checkbox updates)

updateFilterNavigation()

Update filter navigation (left side filter tabs)

updateFilterPanels()

Update filter panels (right side filter options)

updateFilterPills()

Update filter pill display

updateSearchDisplay()

Update search display

updateToolbar()

Update toolbar UI based on current state

(async) updateView()

Update existing view with current state

updateViewTabs()

Update view tabs from state