\BootstrapTagField
Creates a field that allows multiple selection, like a CheckboxSetField to store in a many_many, has_many, or native field (comma separated values) and provides typeahead searching on a given result set. Useful for multiple selection of a densely populated data set, like tags.
- Author: Uncle Cheese <unclecheese@leftandmain.com>
Synopsis
class BootstrapTagField
extends CheckboxSetField
{
- // members
- private static array $allowed_actions = ;
- protected SS_List $prefetch;
- protected $labelField;
- protected $idField;
- protected boolean $freeInput = false;
- // methods
- public void __construct()
- protected string formatJSON()
- public string query()
- public string prefetch()
- protected string getValuesJSON()
- public BootstrapTagField setPrefetch()
- public BootstrapTagField setFreeInput()
- public void setValue()
- public BootstrapTagField setLabelField()
- public BootstrapTagField setIDField()
- public void saveInto()
- public SSViewer Field()
Hierarchy
Extends
- CheckboxSetField
Members
private
- $allowed_actions
—
array
A list of allowed action
protected
- $freeInput
—
boolean
Determines whether free text is allowed - $idField
—
string
The field that will be stored in the database, e.g. "ID" - $labelField
—
string
The field that will serve as the visible representation of the record, e.g. "Title" - $prefetch
—
SS_List
A list of records to prefetch, for instant response on typeahead.
Methods
protected
- formatJSON() — Formats JSON so that it is usable by the JS component
- getValuesJSON() — Gets the current values assigned to the field, formatted as a JSON array
public
- __construct() — Constructor
- Field() — Renders the field
- prefetch() — An AJAX endpoint for getting the prefetch JSON
- query() — An AJAX endpoint for querying the typeahead
- saveInto() — Save the current value into a DataObject.
- setFreeInput() — Enables input of free text, rather than binding to a set list of options
- setIDField() — Sets the ID field
- setLabelField() — Sets the label field
- setPrefetch() — Sets the prefetch records list
- setValue()