diff --git a/widgets/ListView.php b/widgets/ListView.php index 702df2a..70eb443 100644 --- a/widgets/ListView.php +++ b/widgets/ListView.php @@ -1,5 +1,4 @@ sortable, 'url', false); - + if ($route) { $url = Url::toRoute($route); @@ -57,12 +56,18 @@ protected function initSortable() } $options = json_encode(ArrayHelper::getValue($this->sortable, 'options', [])); - + $view = $this->getView(); $view->registerJs("jQuery('#{$this->id}').SortableListView('{$url}', {$options});"); - $view->registerJs("jQuery('#{$this->id}').on('sortableSuccess', function() {jQuery.pjax.reload(" . json_encode($this->clientOptions) . ")})", \yii\web\View::POS_END); + + $reload = ArrayHelper::getValue($this->sortable, 'reload', true); + + if ($reload) + { + $view->registerJs("jQuery('#{$this->id}').on('sortableSuccess', function() {jQuery.pjax.reload(".json_encode($this->clientOptions).")})", \yii\web\View::POS_END); + } + ListViewSortableAsset::register($view); } } - -} +} \ No newline at end of file