Best solution for a drop down list with over 300 rows?

后端 未结 3 533
迷失自我
迷失自我 2021-01-06 19:41

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

相关标签:
3条回答
  • 2021-01-06 20:10

    you can try jquery ajax autocomplete

    Refer to:

    http://docs.jquery.com/Plugins/Autocomplete

    http://jqueryui.com/demos/autocomplete/

    0 讨论(0)
  • 2021-01-06 20:23

    Yes, the jQuery autocomplete plugin is the best solution for you while you have a large number of items.

    By the way, imagine that you would like to select an item with specific letters. While you are using drop down lists, you can point to your wanted items by typing their names from the first letter of each one. But using jQuery autocomplete, you can search a string or a group of letters in everywhere. it does not matter if are your inserted letters located at the first of your item names or in other places.

    As ShantanuD said, you can find this plugin in http://jqueryui.com/demos/autocomplete/

    0 讨论(0)
  • 2021-01-06 20:33

    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
    0 讨论(0)
提交回复
热议问题