Class rootlocal\widgets\sortable\SortableWidget

Inheritancerootlocal\widgets\sortable\SortableWidget » yii\base\Widget

Class SortableWidget Sortable JQuery Widget

Documentation Jquery js: api.jqueryui.com

Public Properties

Hide inherited properties

Property Type Description Defined By
$hash string Hash variable to store the plugin rootlocal\widgets\sortable\SortableWidget::getHash() rootlocal\widgets\sortable\SortableWidget
$jsOptions void JS object options rootlocal\widgets\sortable\SortableWidget::getJsOptions() rootlocal\widgets\sortable\SortableWidget
$options array Options for js plugin
Documentation Jquery js: api.jqueryui.com
action 'sort' Адрес url экшена котроллера на который отправляется запрос
axis 'y' Позволяет задать ось, по которой можно перетаскивать элемент.
rootlocal\widgets\sortable\SortableWidget
$selector string Css JQuery Selector Default .grid-view rootlocal\widgets\sortable\SortableWidget
$sortValueSelector string Css JQuery Selector for sort value col rootlocal\widgets\sortable\SortableWidget
$sortableAction string|array Controller Sorted action see rootlocal\widgets\sortable\SortableGridAction rootlocal\widgets\sortable\SortableWidget

Public Methods

Hide inherited methods

Method Description Defined By
getHash() Generates a hashed variable to store the plugin rootlocal\widgets\sortable\SortableWidget
getJsOptions() Getting JS options rootlocal\widgets\sortable\SortableWidget
init() Initializes the object. rootlocal\widgets\sortable\SortableWidget

Constants

Hide inherited constants

Constant Value Description Defined By
PLUGIN_NAME 'sortable_grid_view' String The name of the jQuery plugin to use for this widget. rootlocal\widgets\sortable\SortableWidget

Property Details

Hide inherited properties

$hash public property

Hash variable to store the plugin rootlocal\widgets\sortable\SortableWidget::getHash()

public string $hash null
$jsOptions public property
public void $jsOptions null
$options public property

Options for js plugin


Documentation Jquery js: api.jqueryui.com
action 'sort' Адрес url экшена котроллера на который отправляется запрос

axis 'y' Позволяет задать ось, по которой можно перетаскивать элемент. Возможные значения:
'x' элемент можно будет перетаскивать только по горизонтали
'y' элемент можно будет перетаскивать только по вертикали

cursor 'move' Позволяет задать вид курсора мыши во время перетаскивания.

opacity '0.9' Устанавливает прозрачность элемента помощника
(элемент, который отображается во время перетаскивания).

items tr Указывает какие элементы в группе могут быть отсортированы.
Значение '> *' - все элементы в выбранной группе

handle '.sortable-column-btn' Указывает элемент, при щелчке на который начнется перетаскивание.

public array $options = []
$selector public property

Css JQuery Selector Default .grid-view

public string $selector '.grid-view'
$sortValueSelector public property

Css JQuery Selector for sort value col

public string $sortValueSelector '.sort_order'
$sortableAction public property

Controller Sorted action see rootlocal\widgets\sortable\SortableGridAction

public string|array $sortableAction = [
    
'sort',
]

Method Details

Hide inherited methods

getHash() public method

Generates a hashed variable to store the plugin

public string getHash ( )

                public function getHash(): string
{
    if (empty($this->_hash)) {
        $this->_hash = $this::PLUGIN_NAME . '_'
            . hash('crc32', $this->id . $this->getJsOptions());
    }
    return $this->_hash;
}

            
getJsOptions() public method

Getting JS options

public string getJsOptions ( )

                public function getJsOptions(): string
{
    if ($this->_jsOptions === null) {
        $defaultOptions = [
            'action' => $this->sortableAction,
            'sortValueSelector' => $this->sortValueSelector,
        ];
        $options = ArrayHelper::merge($defaultOptions, $this->options);
        $json = Json::htmlEncode($options);
        $this->_jsOptions = new JsExpression($json);
    }
    return $this->_jsOptions;
}

            
init() public method

Initializes the object.

This method is called at the end of the constructor. The default implementation will trigger an EVENT_INIT event.

public void init ( )

                public function init()
{
    parent::init();
    $this->sortableAction = Url::to($this->sortableAction);
    $view = $this->getView();
    $this->registerAssets($view);
    $this->registerClientScripts($view);
}