Commit 09946158 by Qiang Xue

removed duplicated query parameters.

parent 13b7c8e8
...@@ -61,17 +61,23 @@ ...@@ -61,17 +61,23 @@
applyFilter: function () { applyFilter: function () {
var $grid = $(this); var $grid = $(this);
var settings = $grid.data('yiiGridView').settings; var settings = $grid.data('yiiGridView').settings;
var data = $(settings.filterSelector).serialize(); var data = {};
var url = settings.filterUrl; $.each($(settings.filterSelector).serializeArray(), function () {
if (url.indexOf('?') >= 0) { data[this.name] = this.value;
url += '&' + data; });
} else {
url += '?' + data; $.each(yii.getQueryParams(settings.filterUrl), function (name, value) {
if (data[name] === undefined) {
data[name] = value;
} }
});
var pos = settings.filterUrl.indexOf('?');
var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);
$grid.find('form.gridview-filter-form').remove(); $grid.find('form.gridview-filter-form').remove();
var $form = $('<form action="' + url + '" method="get" class="gridview-filter-form" style="display:none" data-pjax></form>').appendTo($grid); var $form = $('<form action="' + url + '" method="get" class="gridview-filter-form" style="display:none" data-pjax></form>').appendTo($grid);
$.each(yii.getQueryParams(url), function (name, value) { $.each(data, function (name, value) {
$form.append($('<input type="hidden" name="t" value="" />').attr('name', name).val(value)); $form.append($('<input type="hidden" name="t" value="" />').attr('name', name).val(value));
}); });
$form.submit(); $form.submit();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment