Skip to content

Commit 0c96a82

Browse files
committed
fir #5
1 parent d9f80c4 commit 0c96a82

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Add the column to your grid view and specify the sorting url like here:
5858
```php
5959
echo \yii\grid\GridView::widget([
6060
'dataProvider' => $model->search(),
61+
'rowOptions' => function ($model, $key, $index, $grid) {
62+
return ['data-sortable-id' => $model->id];
63+
},
6164
'columns' => [
6265
[
6366
'class' => \kotchuprik\sortable\grid\Column::className(),

assets/files/js/sortable-widgets.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ function initSortableWidgets() {
22
$('[data-sortable-widget=1] tbody').sortable({
33
animation: 300,
44
handle: '.sortable-widget-handler',
5-
dataIdAttr: 'data-key',
5+
dataIdAttr: 'data-sortable-id',
66
onEnd: function (e) {
77
$.post($(this.el).parents('[data-sortable-widget=1]').data('sortable-url'), {
88
sorting: this.toArray()
99
});
1010
}
1111
});
1212
}
13-

0 commit comments

Comments
 (0)