Are there any built in auto-complete input components for Polymer 1.0? [closed]

送分小仙女□ 提交于 2019-11-29 16:56:52

问题


I've been muddling around with Polymer 1.0 since its release, and I've hit a use case where a select list just won't be sufficient (too many options to select from). What I really need is an autocomplete textbox.

Is there one built-in or planned in the paper or iron Polymer controls? Or should I be looking at autocomplete solutions from other frameworks? So far, I've been able to keep my app light-weight, and I'd prefer to avoid other frameworks if I can help it.

Thanks,

Ryan

Edit: The best place I've seen to bring up a first-party developed autocomplete is on the PolymerElements/paper-elements repo on GitHub. I'd discuss at https://github.com/PolymerElements/paper-elements/issues/26.


回答1:


Vaadin's combo box looks pretty solid:

There is also Ellipticaljs's Paper Autocomplete, with a possible alternative md-autocomplete in the works.

You can find more autocomplete elements by searching at http://customelements.io.




回答2:


For now, I've settled on using HTML5 datalists in conjunction with a modified <paper-input> control (I've submitted a pull request to the Github repo to merge those changes back into the master branch). All those changes do is persist the list attribute to the inner <iron-input> control so that it can utilize an HTML5 datalist.

Definitely not ideal, but, in the short-term, it'll function as a placeholder in place of a real typeahead control.

I also built a quick custom validator that iterates over the same Array collection as what I use in my datalist so that the <paper-input> control knows if the current value is a selectable (valid) value or not.

Edit: The best place I've seen to bring up a first-party developed autocomplete is on the PolymerElements/paper-elements repo on GitHub. I'd discuss at https://github.com/PolymerElements/paper-elements/issues/26.



来源:https://stackoverflow.com/questions/30738342/are-there-any-built-in-auto-complete-input-components-for-polymer-1-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!