{"action":"created","issue":{"url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/757","repository_url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget","labels_url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/757/labels{/name}","comments_url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/757/comments","events_url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/757/events","html_url":"https://github.com/ehynds/jquery-ui-multiselect-widget/issues/757","id":300762487,"number":757,"title":"How to select an option by default? and apply without a click()?","user":{"login":"schittuluri1","id":34896174,"avatar_url":"https://avatars2.githubusercontent.com/u/34896174?v=4","gravatar_id":"","url":"https://api.github.com/users/schittuluri1","html_url":"https://github.com/schittuluri1","followers_url":"https://api.github.com/users/schittuluri1/followers","following_url":"https://api.github.com/users/schittuluri1/following{/other_user}","gists_url":"https://api.github.com/users/schittuluri1/gists{/gist_id}","starred_url":"https://api.github.com/users/schittuluri1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schittuluri1/subscriptions","organizations_url":"https://api.github.com/users/schittuluri1/orgs","repos_url":"https://api.github.com/users/schittuluri1/repos","events_url":"https://api.github.com/users/schittuluri1/events{/privacy}","received_events_url":"https://api.github.com/users/schittuluri1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-27T19:30:29Z","updated_at":"2018-02-28T02:25:17Z","closed_at":null,"author_association":"NONE","body":"I am trying to preset a refiner on SharePoint 2013 search.I have used multivalue display template and added the multiselect. Now I have a requirement to select a single value from one of the dropdown to be enabled only on page load, but remove it when users want to select some other refiner like as usually works. I was able to use get labels method and refresh the multiselect. But unless I click on the dropdown the filter is not applying to search results.Can anyone help, where to keep the jQuery(\"#\" + \"FileType\" + \"Select\").multiselect(\"getLabels\").find(\"input[value='ǂǂ786c7378']\").click(); for this to apply the filter on only first time page load.\r\n\r\nThis code executes only when I click on dropdown and close. Because of the Close(). Is there like a manually trigger this programatically?\r\nOr Simple how to apply close function only once after option is selected programatically?\r\n\r\nI was using this as well.\r\n\r\n`jQuery(this).find('a.ui-multiselect-close').click();`\r\n\r\nI need to select the option which I am able to but it is not triggering a refresh of another function. How to do this?\r\n\r\n```\r\njQuery(\"#\" + propertyName + \"Select\").multiselect({\r\n  selectedList: 10,\r\n  close: function() {\r\n    var refinement = {};\r\n    refinement[ctx.RefinementControl.propertyName] = [];\r\n    var thisvariable = this;\r\n    jQuery(\"#\" + propertyName + \"Select\").multiselect(\"getChecked\").each(function() {\r\n      refinement[ctx.RefinementControl.propertyName].push('\"' + $(this).val() + '\"');\r\n    });\r\n    if (refinement[ctx.RefinementControl.propertyName].length == 0) {\r\n      delete refinement[ctx.RefinementControl.propertyName];\r\n    }\r\n    $getClientControl(this).updateRefinersJSON('{\"' + ctx.RefinementControl.propertyName + '\":null}');\r\n    $getClientControl(this).addRefinementFiltersJSONWithOr(JSON.stringify(refinement));\r\n\r\n    //push a single refinement on ducment ready\r\n    jQuery(\"#\" + \"FileType\" + \"Select\").multiselect(\"getLabels\").find(\"input[value='ǂǂ786c7378']\").click();\r\n    var refinement = {};\r\n    refinement[\"FileType\"] = [];\r\n    var value = \"ǂǂ786c7378\";\r\n    refinement[\"FileType\"].push('\"' + value + '\"');\r\n    $getClientControl(this).addRefinementFiltersJSONWithOr(JSON.stringify(refinement));\r\n  }\r\n});\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/comments/369099195","html_url":"https://github.com/ehynds/jquery-ui-multiselect-widget/issues/757#issuecomment-369099195","issue_url":"https://api.github.com/repos/ehynds/jquery-ui-multiselect-widget/issues/757","id":369099195,"user":{"login":"mlh758","id":4331955,"avatar_url":"https://avatars1.githubusercontent.com/u/4331955?v=4","gravatar_id":"","url":"https://api.github.com/users/mlh758","html_url":"https://github.com/mlh758","followers_url":"https://api.github.com/users/mlh758/followers","following_url":"https://api.github.com/users/mlh758/following{/other_user}","gists_url":"https://api.github.com/users/mlh758/gists{/gist_id}","starred_url":"https://api.github.com/users/mlh758/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlh758/subscriptions","organizations_url":"https://api.github.com/users/mlh758/orgs","repos_url":"https://api.github.com/users/mlh758/repos","events_url":"https://api.github.com/users/mlh758/events{/privacy}","received_events_url":"https://api.github.com/users/mlh758/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T02:25:17Z","updated_at":"2018-02-28T02:25:17Z","author_association":"COLLABORATOR","body":"What is your overall objective from a high level?\r\n\r\nYou can manually trigger close on the widget by getting the instance and triggering close on it like this: https://github.com/ehynds/jquery-ui-multiselect-widget/blob/master/src/jquery.multiselect.js#L806\r\n\r\nbut it sounds like you're really trying to solve a different problem and using `close` to do it and you probably shouldn't."}}
{"actor":{"display_login":"mlh758"}}