{"action":"created","issue":{"url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/284","repository_url":"https://api.github.com/repos/vaadin/vaadin-combo-box","labels_url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/284/labels{/name}","comments_url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/284/comments","events_url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/284/events","html_url":"https://github.com/vaadin/vaadin-combo-box/issues/284","id":168338771,"number":284,"title":"Expose input-element-value to facilitate AJAX requests","user":{"login":"mercmobily","id":2128734,"avatar_url":"https://avatars.githubusercontent.com/u/2128734?v=3","gravatar_id":"","url":"https://api.github.com/users/mercmobily","html_url":"https://github.com/mercmobily","followers_url":"https://api.github.com/users/mercmobily/followers","following_url":"https://api.github.com/users/mercmobily/following{/other_user}","gists_url":"https://api.github.com/users/mercmobily/gists{/gist_id}","starred_url":"https://api.github.com/users/mercmobily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercmobily/subscriptions","organizations_url":"https://api.github.com/users/mercmobily/orgs","repos_url":"https://api.github.com/users/mercmobily/repos","events_url":"https://api.github.com/users/mercmobily/events{/privacy}","received_events_url":"https://api.github.com/users/mercmobily/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-29T14:36:04Z","updated_at":"2016-07-30T00:49:21Z","closed_at":null,"body":"At the moment, I would like to do something like this:\r\n\r\n    <iron-ajax auto={{searchName}} url=\"/stores/polymer?nameStarts=[[searchName]]\" last-response={{ajaxResponse}}></iron-ajax>\r\n    <vaadin-combo-box id=\"VCC\" input-element-value=\"{{searchName}}\" label=\"Language\" class=\"languages\" items=\"[[ajaxResponse]]\"></vaadin-combo-box>\r\n\r\nBasically, the AJAX request is initiated when something is typed. iron-ajax makes the request to the server, and `{{ajaxResponse}}` is bound to the last response. That bound variable is fed to the wonderful vaadin-combo-box, and voila' -- only the \"legal\" options are available. Nirvana of auto-completion is reached.\r\n\r\nBut! vaadin-combo-box doesn't expose input-element-value. The change is trivial: just add:\r\n\r\n      inputElementValue: {\r\n        type: String,\r\n        notify: true\r\n      },\r\n\r\nAnd then:\r\n\r\n     /**\r\n     *  Filtering and items handling\r\n     */\r\n\r\n    _inputValueChanged: function(e) {\r\n\r\n      // Expose inputElementValue\r\n      this.inputElementValue = this._inputElementValue;\r\n\r\nTo `vaadin-combo-box-behavior.html`. These two changes basically mean that the code above works. I tried a million possible ways to avoid changing vaadin-checkbox, but no -- if the change isn't exposed, it's just not going to work!\r\n\r\nFor the sake of making AJAX autocompletion work, would you accept a pull request with the changes above?\r\n\r\nAnother option would be to rename `_inputElementValue` into `inputElementValue`. However, this would be less than ideal. Really, in terms of facilitating AJAX requests, we should only change `inputElementValue` if there has been an `input` event on the input field. So, in terms of behaviour in terms of making an AJAX request, the way I proposed is _perfect_.\r\n\r\nMaybe inputElementValue isn't _actually_ the best name for it. It should be something like `keyedInValue` or... something that clarifies that it's the result of user typing (hence the auto-completion query).\r\n\r\nThe only way I have to go about it is to write a decorator widget that mirrors _every_ possible input of `vaadin-combo-box.html`, and uses an extra behaviour that overwrites `_inputValueChanged`. But that really is way less than ideal...! Alternatively, I can clone `vaadin-combo-box.html` so that it redefines `_inputValueChanged` but even then...\r\n\r\nIt would be awesome if `vaadin-combo-box` was usable with AJAX-loaded data out of the box. Especially since the modifications would be so minimal...\r\n\r\nThanks for listening! "},"comment":{"url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/comments/236327481","html_url":"https://github.com/vaadin/vaadin-combo-box/issues/284#issuecomment-236327481","issue_url":"https://api.github.com/repos/vaadin/vaadin-combo-box/issues/284","id":236327481,"user":{"login":"mercmobily","id":2128734,"avatar_url":"https://avatars.githubusercontent.com/u/2128734?v=3","gravatar_id":"","url":"https://api.github.com/users/mercmobily","html_url":"https://github.com/mercmobily","followers_url":"https://api.github.com/users/mercmobily/followers","following_url":"https://api.github.com/users/mercmobily/following{/other_user}","gists_url":"https://api.github.com/users/mercmobily/gists{/gist_id}","starred_url":"https://api.github.com/users/mercmobily/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercmobily/subscriptions","organizations_url":"https://api.github.com/users/mercmobily/orgs","repos_url":"https://api.github.com/users/mercmobily/repos","events_url":"https://api.github.com/users/mercmobily/events{/privacy}","received_events_url":"https://api.github.com/users/mercmobily/received_events","type":"User","site_admin":false},"created_at":"2016-07-30T00:49:21Z","updated_at":"2016-07-30T00:49:21Z","body":"I think that's a very workable idea. But.. I really like the vaadin-combo-box! Don't you think that 3 lines of code would be worth make the element totally workable with Ajax calls? It just makes so much sense... I would be happy to send a PR with documentation and tests..."}}
{"actor":{"display_login":"mercmobily"}}