Class yii\jui\Selectable
Inheritance | yii\jui\Selectable » yii\jui\Widget » yii\base\Widget |
---|---|
Available since version | 2.0 |
Selectable renders a selectable jQuery UI widget.
For example:
echo Selectable::widget([
'items' => [
'Item 1',
[
'content' => 'Item2',
],
[
'content' => 'Item3',
'options' => [
'tag' => 'li',
],
],
],
'options' => [
'tag' => 'ul',
],
'itemOptions' => [
'tag' => 'li',
],
'clientOptions' => [
'tolerance' => 'fit',
],
]);
Selectable in begin mode.
Selectable::begin([
'clientOptions' => [
'filter' => 'my-selectable-item',
'tolerance' => 'touch',
],
]);
- Item 1
- Item 2
- Item 3
- Item 4
Selectable::end();
See also http://api.jqueryui.com/selectable/.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$clientEvents | array | The event handlers for the underlying jQuery UI widget. | yii\jui\Widget |
$clientOptions | array | The options for the underlying jQuery UI widget. | yii\jui\Widget |
$itemOptions | array | List of HTML attributes for the item container tags. | yii\jui\Selectable |
$items | array | List of selectable items. | yii\jui\Selectable |
$mode | string | The mode used to render the widget. | yii\jui\Selectable |
$options | array | The HTML attributes for the widget container tag. | yii\jui\Selectable |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$clientEventMap | array | Event names mapped to what should be specified in `. | yii\jui\Widget |
Public Methods
Method | Description | Defined By |
---|---|---|
begin() | Begins a widget. | yii\jui\Selectable |
init() | Initializes the widget. | yii\jui\Selectable |
renderItems() | Renders selectable items as specified on $items. | yii\jui\Selectable |
run() | Renders the widget. | yii\jui\Selectable |
Protected Methods
Method | Description | Defined By |
---|---|---|
registerClientEvents() | Registers a specific jQuery UI widget events | yii\jui\Widget |
registerClientOptions() | Registers a specific jQuery UI widget options | yii\jui\Widget |
registerWidget() | Registers a specific jQuery UI widget asset bundle, initializes it with client options and registers related events | yii\jui\Widget |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
MODE_BEGIN | 'MODE_BEGIN' | yii\jui\Selectable | |
MODE_DEFAULT | 'MODE_DEFAULT' | yii\jui\Selectable |
Property Details
List of HTML attributes for the item container tags. This will be overwritten by the "options" set in individual $items. The following special options are recognized:
- tag: string, defaults to "li", the tag name of the item container tags.
See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
List of selectable items. Each item can be a string representing the item content or an array of the following structure:
[
'content' => 'item content',
// the HTML attributes of the item container tag. This will overwrite "itemOptions".
'options' => [],
]
The mode used to render the widget.
The HTML attributes for the widget container tag. The following special options are recognized:
- tag: string, defaults to "ul", the tag name of the container tag of this widget.
See also \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
Method Details
Begins a widget.
This method creates an instance of the calling class setting the MODE_BEGIN mode. Any item between begin() and \yii\jui\end() which match the filter attribute, will be selectable. It will apply the configuration to the created instance. A matching \yii\jui\end() call should be called later. As some widgets may use output buffering, the \yii\jui\end() call should be made in the same view to avoid breaking the nesting of output buffers.
See also \yii\jui\end().
public static static begin ( $config = [] ) | ||
$config | array | Name-value pairs that will be used to initialize the object properties |
return | static | The newly created widget instance |
---|
Initializes the widget.
public void init ( ) |
Renders selectable items as specified on $items.
public string renderItems ( ) | ||
return | string | The rendering result. |
---|---|---|
throws | \yii\jui\InvalidConfigException. |
Renders the widget.
public void run ( ) |