PHP Class yii\jui\Selectable

For example: php 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. php Selectable::begin([ 'clientOptions' => [ 'filter' => 'my-selectable-item', 'tolerance' => 'touch', ], ]);
  • Item 1
  • Item 2
  • Item 3
  • Item 4
Another item
php Selectable::end();
See also: http://api.jqueryui.com/selectable/
Since: 2.0
Author: Alexander Kochetov ([email protected])
Inheritance: extends yii\jui\Widget
Datei anzeigen Open project: yiisoft/yii2-jui

Public Properties

Property Type Description
$itemOptions 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.
$items 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' => [], ] ~~~
$mode the mode used to render the widget.
$options 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.

Public Methods

Method Description
begin ( array $config = [] ) : static Begins a widget.
init ( ) Initializes the widget.
renderItems ( ) : string Renders selectable items as specified on [[items]].
run ( ) Renders the widget.

Method Details

begin() public static method

This method creates an instance of the calling class setting the MODE_BEGIN mode. Any item between Selectable::begin and [[end()]] which match the filter attribute, will be selectable. It will apply the configuration to the created instance. A matching [[end()]] call should be called later. As some widgets may use output buffering, the [[end()]] call should be made in the same view to avoid breaking the nesting of output buffers.
See also: end()
public static begin ( array $config = [] ) : static
$config array name-value pairs that will be used to initialize the object properties
return static the newly created widget instance

init() public method

Initializes the widget.
public init ( )

renderItems() public method

Renders selectable items as specified on [[items]].
public renderItems ( ) : string
return string the rendering result.

run() public method

Renders the widget.
public run ( )

Property Details

$itemOptions public_oe property

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.
public $itemOptions

$items public_oe property

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' => [], ] ~~~
public $items

$mode public_oe property

the mode used to render the widget.
public $mode

$options public_oe property

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.
public $options