4 Replies Latest reply on Jun 2, 2015 6:19 AM by Sathish Kumar

    Create check boxes inside h:selectManyListBox

    Sathish Kumar Newbie

      Hi All,

       

      I am developing jsf application with richfaces component library. And i want to create many check boxes inside the select menu

      And i am tried of doing this... I want to create select many list box like below

       

      <h:selectManyListbox  id="county" styleClass="mylength3" value="#{countryBean.countyList}"

        style="width:110px" size = "5"  >

           <h:selectManyCheckbox id="countyCheck"  layout="pageDirection">

               <f:selectItems value="#{userBean.userCountyIdNameList}" var="list" itemLabel="#{list.countyName}" itemValue="#{list.countyId}"/>  

          </h:selectManyCheckbox>

      </h:selectManyListbox >

       

      This is what i want http://www.1stwebdesigns.com/blog/development/multiple-select-with-checkboxes-and-jquery

       

      Thanks in advance..

        • 1. Re: Create check boxes inside h:selectManyListBox
          Michal Petrov Master

          Hi,

           

          h:selectManyListbox is a JSF component (not a RichFaces one) but in any case what you want is not possible with that component, you cannot put checkboxes in a <select>. Can't you use h:selectManyCheckbox instead?

          • 2. Re: Create check boxes inside h:selectManyListBox
            Sathish Kumar Newbie

            Thank you for your reply Michal

             

            ofcourse I am using h:selectManyCheckbox  at present. But there are some differents in the look and feel between the h:selectManyListbox and h:selectManyCheckbox. So my client wants the list of checkboxes to be placed inside the select menu with the same behaviour of h:selectManyListbox.

             

             

            Capture.JPG  Capture2.JPG

              

            This is what i am using now. But there is no functionality like "selecting all the check boxes by pressing SHIFT key" where as the h:selectManyListbox has this functionality by default  and the selected items will not be highlighted like the "state" highlighted.

             

            This is the work around that i am doing now....

             

            If we have  h:selectManyCheckbox inside h:selectManyListbox will be much better . Thank you for your reply

            • 3. Re: Create check boxes inside h:selectManyListBox
              Michal Petrov Master

              Selecting items by Shift + click is not programmed into the h:selectManyListbox component, it's how the <select> element works (it's probably enabled by the OS, not even the browser). You could make it work like that with JavaScript, and the highlighting as well.

               

              Though if it's just the look you're after you can put the checkbox in as a background image for <option>, since it is absolutely redundant. Otherwise what you want is simply not possible, you cannot combine the components like that.

              • 4. Re: Create check boxes inside h:selectManyListBox
                Sathish Kumar Newbie

                Hi Michal,

                 

                Thank you for your reply. What you are suggesting is right. So today I did the work around for this problem now. And i did the work around for selecting multiple items by pressing SHIFT+Click .

                 

                It would be much better if we are able to combine the two components.

                 

                Thank you