Contents

Backend\FormWidgets\DataTable

Overview

Data Table Renders a table field.

Extends
Implements
  • Larajax\Contracts\ViewComponentInterface

Public Properties

public string $size

Table size

public bool $rowSorting

Allow rows to be sorted

public bool $legacyMode

legacyMode uses legacy Table widget instead of Handsontable

Show inherited public properties

Inherited Public Properties

Protected Properties

protected $defaultAlias

defaultAlias to identify this widget.

protected array $processedColumns

Processed columns

protected array $ajaxColumns

Columns requiring AJAX options

protected array $columnDependencies

Column dependencies

protected Backend\Widgets\Table $table

table widget used in legacy mode

Show inherited protected properties

Inherited Protected Properties


Public Methods

public getLegacyDataTableOptions()

public getLegacyDataTableOptions($columnName, $rowData): void

getLegacyDataTableOptions is the legacy dropdown/autocomplete option callback handler

public getLoadValue()

public getLoadValue(): void

getLoadValue returns the value for this form field, supports nesting via HTML array.

public getSaveValue()

public getSaveValue($value): void

getSaveValue processes the postback value for this widget. If the value is omitted from postback data, the form widget will be skipped.

public getTable()

public getTable(): Backend\Widgets\Table 

public init()

public init(): void

init the widget, called by the constructor and free from its parameters.

public onExportCsv()

public onExportCsv(): void

onExportCsv downloads the posted rows as CSV, with the column titles as the header row

public onGetDropdownOptions()

public onGetDropdownOptions(): void

onGetDropdownOptions handles AJAX requests for dropdown/autocomplete options

public onImportCsv()

public onImportCsv(): void

onImportCsv reads posted CSV text into rows keyed by column, matching the header row to column titles or names, or using the column order when the first row is not a header

public prepareVars()

public prepareVars(): void

prepareVars for display

public render()

public render(): void

render the widget's primary contents.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected buildColumn()

protected buildColumn($name, $config): array 

buildColumn builds a single column config for Handsontable

protected buildOptionSource()

protected buildOptionSource($options): array 

buildOptionSource converts a YAML {key: label} options map into the Handsontable {key, value} object source format.

protected buildOptions()

protected buildOptions(): array 

buildOptions builds the global Handsontable configuration

protected columnNeedsAjax()

protected columnNeedsAjax($config): bool 

columnNeedsAjax determines if a column needs AJAX-loaded options

protected getCsvHeaderColumnMap()

protected getCsvHeaderColumnMap($header): array 

getCsvHeaderColumnMap maps CSV header positions to column names by title or name, returning an empty array when no header cell matches a column

protected getFieldConfig()

protected getFieldConfig($name, $default = null): void

getFieldConfig reads an option from the form field config with a fallback to the widget config, supporting standalone makeFormWidget instances.

protected getLegacyLoadValue()

protected getLegacyLoadValue(): void

getLegacyLoadValue returns the load value for legacy mode

protected getLegacySaveValue()

protected getLegacySaveValue($value): void

getLegacySaveValue returns the save value for legacy mode

protected getTypeConfig()

protected getTypeConfig($type, $config): array 

getTypeConfig maps DataTable column types to Handsontable types

protected loadAssets()

protected loadAssets(): void

loadAssets adds widget specific asset files. Use $this->addJs() and $this->addCss() to register new assets to include on the page.

protected makeLegacyTableWidget()

protected makeLegacyTableWidget(): void

makeLegacyTableWidget creates a legacy table widget instance

protected neutralizeCsvFormula()

protected neutralizeCsvFormula($value): void

neutralizeCsvFormula prepends an apostrophe to values a spreadsheet would read as a formula

protected populateLegacyTableWidget()

protected populateLegacyTableWidget(): void

populateLegacyTableWidget populates the legacy table widget with data

protected prepareLegacyVars()

protected prepareLegacyVars(): void

prepareLegacyVars prepares view variables for legacy mode

protected processColumns()

protected processColumns(): void

processColumns processes column definitions into Handsontable format

Show inherited protected methods

Inherited Protected Methods