有超过300行的下拉列表的最佳解决方案? [英] Best solution for a drop down list with over 300 rows?
问题描述
我有这个问题,在一个表单中,我有一个可能超过300的客户列表,对于我来说,在那里找到并不是很简单,因为我应该滚动所有结果来查找单个行! / p>
在旧技术中,我有一个按钮,打开一个弹出窗口,在那里我应该研究应该选择哪个客户,而不是使用JavaScript来记录第一个窗体上的选择,但它可能是一个很好的解决方案,新技术!
我该如何解决这个疑问?对于大< select>
标记?
你基本上需要一个自动完成下拉列表。这在标准JSF组件集中不存在,并且在标准JSF组件集之上使用JavaScript / jQuery实现也不是微不足道的,因为可用值必须存在于服务器端的状态中。您还基本上需要一个由< div>< input>< ul>< li>< / code>代替的下拉列表,而不是
< select>< option>
因为普通的< select>
不允许enduser输入文本。标准的JSF组件set没有一个呈现所需HTML标记的组件。您基本上需要创建一个定制的JSF组件。
有第三方JSF组件库已经提供了一个完整的JSF自动完成下拉列表。使用它们中的任何一个都可能更容易,而不是通过定制的JSF组件重新发明轮子。请选择:
- PrimeFaces -
< p:autoComplete>
组件 - RichFaces -
< rich:autocomplete>
组件 - OpenFaces -
< o:suggestionField>
组件 b $ b - ICEfaces -
< ice:selectInputText>
组件
I have this problem, in a form I have a list of customers that could be more than 300 and, for me, it isn't very simple find over there because I should scroll all results for find a single row!
On the old technology I had a button that opened a pop up where I should research which customer I should select and than I used a javascript for recording the selection on the first form, but It could be a good solution with new technology!
How can I resolve this doubt? What is the best solution for big <select>
tag?
You basically want an autocomplete dropdown list. This does not exist in the standard JSF component set and it is also not exactly trivial to implement with JavaScript/jQuery on top of the standard JSF component set because the available values have to be present in the server side's state. You also basically want a dropdown list which is represented by a <div><input><ul><li>
instead of a <select><option>
because a normal <select>
doesn't allow the enduser to type text in. The standard JSF component set does not have a component which renders the desired HTML markup. You'd basically need to create a custom JSF component.
There are 3rd party JSF component libraries which already offer a fullworthy JSF autocomplete dropdown list. It would be easier to use either of them instead of reinventing the wheel by a custom JSF component. Take your pick:
- PrimeFaces - the
<p:autoComplete>
component - RichFaces - the
<rich:autocomplete>
component - OpenFaces - the
<o:suggestionField>
component - ICEfaces - the
<ice:selectInputText>
component
这篇关于有超过300行的下拉列表的最佳解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!