{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/6923","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/6923/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/6923/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/6923/events","html_url":"https://github.com/yiisoft/yii2/issues/6923","id":54759946,"number":6923,"title":"yii\\grid\\GridView: support filters with multiselect","user":{"login":"katzz0","id":3775283,"avatar_url":"https://avatars.githubusercontent.com/u/3775283?v=3","gravatar_id":"","url":"https://api.github.com/users/katzz0","html_url":"https://github.com/katzz0","followers_url":"https://api.github.com/users/katzz0/followers","following_url":"https://api.github.com/users/katzz0/following{/other_user}","gists_url":"https://api.github.com/users/katzz0/gists{/gist_id}","starred_url":"https://api.github.com/users/katzz0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katzz0/subscriptions","organizations_url":"https://api.github.com/users/katzz0/orgs","repos_url":"https://api.github.com/users/katzz0/repos","events_url":"https://api.github.com/users/katzz0/events{/privacy}","received_events_url":"https://api.github.com/users/katzz0/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:enhancement","name":"type:enhancement","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-19T12:50:19Z","updated_at":"2015-12-05T18:30:50Z","closed_at":"2015-12-05T18:30:50Z","body":"I tried to use multi select and got a weird results. You can try select with simple multi attribute or take for example this jQuery plugin https://select2.github.io/ The filter mark 'selected' some option and ignore others options. I found  some funny code after examination yii.gridView.js. Method applyFilter construct data object and then use it for form submission. But if we have some values with identical names then the previous value overrides others.\r\n\r\nAlternatively we can use data as array of objects.\r\n\r\n<pre><code>\r\napplyFilter: function () {\r\n            var $grid = $(this), event;\r\n            var settings = gridData[$grid.prop('id')].settings;\r\n            var data = {};\r\n            $.each($(settings.filterSelector).serializeArray(), function () {\r\n                data[this.name] = this.value;\r\n            });\r\n\r\n            $.each(yii.getQueryParams(settings.filterUrl), function (name, value) {\r\n                if (data[name] === undefined) {\r\n                    data[name] = value;\r\n                }\r\n            });\r\n\r\n            var pos = settings.filterUrl.indexOf('?');\r\n            var url = pos < 0 ? settings.filterUrl : settings.filterUrl.substring(0, pos);\r\n\r\n            $grid.find('form.gridview-filter-form').remove();\r\n            var $form = $('<form action=\"' + url + '\" method=\"get\" class=\"gridview-filter-form\" style=\"display:none\" data-pjax></form>').appendTo($grid);\r\n            $.each(data, function (name, value) {\r\n                $form.append($('<input type=\"hidden\" name=\"t\" value=\"\" />').attr('name', name).val(value));\r\n            });\r\n            \r\n            event = $.Event(gridEvents.beforeFilter);\r\n            $grid.trigger(event);\r\n            if (event.result === false) {\r\n                return;\r\n            }\r\n\r\n            $form.submit();\r\n            \r\n            $grid.trigger(gridEvents.afterFilter);\r\n        }\r\n</code></pre>"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/162232900","html_url":"https://github.com/yiisoft/yii2/issues/6923#issuecomment-162232900","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/6923","id":162232900,"user":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"created_at":"2015-12-05T18:30:50Z","updated_at":"2015-12-05T18:30:50Z","body":"Resolved by https://github.com/yiisoft/yii2/commit/d3cfb87ba67a328d197d1a9e52dbb12a7bf8476b, #10302"}}