Class rootlocal\widgets\sortable\SortableWidget
Inheritance | rootlocal\widgets\sortable\SortableWidget » yii\base\Widget |
---|
Class SortableWidget Sortable JQuery Widget
Documentation Jquery js: api.jqueryui.com
Public 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
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
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
Hash variable to store the plugin rootlocal\widgets\sortable\SortableWidget::getHash()
JS object options rootlocal\widgets\sortable\SortableWidget::getJsOptions()
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'
Указывает элемент, при щелчке на который начнется перетаскивание.
Css JQuery Selector Default .grid-view
Css JQuery Selector for sort value col
Controller Sorted action see rootlocal\widgets\sortable\SortableGridAction
Method Details
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;
}
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;
}
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);
}