Skip to content

Commit a2baa34

Browse files
authored
Merge pull request #7 from execut/master
Request parameter "ids" change support
2 parents 5b4539e + 7fe6ecc commit a2baa34

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ Version 1.0.0 July 15, 2014
55
---------------------------
66

77
- Initial release
8+
9+
Version 1.1.0 December 09, 2016
10+
---------------------------
11+
12+
- Request parameter "ids" change support
13+
14+
Version 1.1.1 March 10, 2017
15+
---------------------------
16+
17+
- Added CSRF notice in documentaion

DOCUMENTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ DeleteMultipleAction Class
5757

5858
[renderTagAttributes()]:http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail
5959
[dropDownList()]:http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#dropDownList()-detail
60-
[t()]:http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail
60+
[t()]:http://www.yiiframework.com/doc-2.0/yii-baseyii.html#t()-detail

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public function actions()
7979
8080
> Tip: For information about properties and methods of the widget, see the bundled `DOCUMENTATION.md`.
8181
82+
### CSRF validation
83+
For enable CSRF validation make sure you have ```<?= Html::csrfMetaTags() ?>``` in main layout.
84+
8285
Examples
8386
--------
8487

Widget.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ protected function renderElements($template)
215215
if (this.value) {
216216
var ids = $('#{$this->grid}').yiiGridView('getSelectedRows'),
217217
dataConfirm = this.options[this.selectedIndex].getAttribute('data-confirm'),
218-
url = this.options[this.selectedIndex].getAttribute('url');
218+
opts = this.options[this.selectedIndex],
219+
url = opts.getAttribute('url');
219220
220221
if (!ids.length) {
221222
alert('" . $this->t('widget', 'Please select one or more items from the list.') . "');
@@ -232,7 +233,7 @@ protected function renderElements($template)
232233
form.append('<input type=\"hidden\" name=' + csrfParam + ' value=' + csrfToken + ' />');
233234
}
234235
$.each(ids, function(index, id) {
235-
form.append('<input type=\"hidden\" name=\"ids[]\" value=' + id + ' />');
236+
form.append('<input type=\"hidden\" name=\"' + (opts.getAttribute('name') ? opts.getAttribute('name') : 'ids') + '[]\" value=' + id + ' />');
236237
});
237238
form.appendTo('body').submit();
238239
}

0 commit comments

Comments
 (0)