7 Replies Latest reply on Oct 13, 2011 12:36 PM by bleathem

    What to do about the columnVar/var attributes of the pickList?

    bleathem

      See issue: https://issues.jboss.org/browse/RF-11208

       

      Summarized here:

      If we want the pickList to be able to define it's own select items, the way the orderingLIst does, then the syntax looks like:

      <r:pickList values="..." colmunVar="columnVar" itemValues="..." var="itemVar" itemLabel="#{itemVar.title}"> <r:column> #{columnVar.somAttribute} </r:column> </r:pickList>

       

      where columnVar iterates over the values, and is used as the replacement variable while rendering the columns
      and var iterates over the itemValues, and is used as the replacement variable when defining the selectItems.

      One question is, if we drop the columnVar, and recycle the "var" attribute between the two contexts, is that more or less confusing for end-users?

      Or, another alternative, is to not support the pickList defining selectItems itself, it alway require a f:selectItems child - but I don't think I like this alternative.

       

      So, any suggestions on how to clen up the above syntax?  The only real constraint is being consistent with the APIs of the other RichFaces and JSF components.  PickList is unique, for having two looping contexts.

        • 1. Re: What to do about the columnVar/var attributes of the pickList?
          ilya_shaikovsky

          Me personally think that it should be enough to have one context.

           

          <f:selectItems> allows you to point the component to any set of objects. And I think it's preferrable to keep one entry point for such definitions. What additionally itemValues gaves to the user?

           

          just select items labels:

          <rich:pickList value=#{targetValues} columnVar="foo">

               <f:selectItems value="#{beanSelector.values}" itemLabel="#{foo.label}"/>

               <f:converter converterId="EntityBeanConverter" />

          </rich:pickList>

           

          custom columns

          <rich:pickList value=#{targetValues} columnVar="foo">

               <f:selectItems value="#{beanSelector.values}"/>

               <f:converter converterId="EntityBeanConverter" />

               <rich:column>#{foo.title}</rich:column>

               <rich:column>#{foo.value}</rich:column>

          </rich:pickList>

           

          Or I missed something from prev threads and such simple approach has some usability losses or dev issues?

           

          P.S. why values and not value? I think we could use the same syntax as h:selectMany.

          • 2. Re: What to do about the columnVar/var attributes of the pickList?
            bleathem

            Thanks Ilya,

             

            (sorry, the values was a typo, the attribute is indeed value)

             

            I suppose not enabling the pickList to define the list of source items itself is worth more strongly considering,  It does after all have a more "JSF feel" feel to it.  I originally wanted to allow for more conciseness with the component, but if the end result is too much complexity, then we are worse off overall.

             

            Thanks again for the feedback!

             

            Brian

            • 3. Re: What to do about the columnVar/var attributes of the pickList?
              lfryc

              Hi Brian, Ilya,

               

              Brian Leathem wrote:

               

              So far, Ilya's suggestion of requiring the pickList to use the f:selectItems appears to be the best option (ad drop the var sttribute from the pickList.  Although I'm not entirely happy how this makes the pick and ordering lists dissimilar.

               

              I have looked through dev-examples [1] and Ilya's suggestion looks good for me.

               

              1. It would be great to have f:selectItems @itemLabel to and @itemValue consuming EL expressions (I can't see that option in dev-examples)
              2. You are going to drop rich:pickList @columnVar and use f:selectItems @var instead?
              3. What about just renaming rich:pickList @columnVar to @var?
                • since there is no more @itemVar, it is not necessary to define @columnVar
                • and it will no conflict as in Ilya's "just select items labels:" - columnVar=foo, itemLabel=#{foo.label}
              4. As I understand, rich:pickList and rich:orderingList shares implementation currently? We will loose this advantage when using some of options above?
                1. If not, I don' tsee problem in making them dissimilar, since they are targetting other purposes

               

              [1] https://github.com/richfaces/dev-examples/blob/develop/input-demo/src/main/webapp/examples/pickList.xhtmlhttps://github.com/richfaces/dev-examples/blob/06da70955e414e43597162498929824ce3813713/input-demo/src/main/webapp/examples/pickList.xhtml

              • 4. Re: What to do about the columnVar/var attributes of the pickList?
                jbalunas

                I also agree with Lukas and Ilya, and I think the followup points that Lukas mentions are valid as well. 

                 

                • Can itemLabel, and itemValue consume EL?
                • Using select items imo is fine, it is how I think most developers would use this anyway.
                  • One problem back in 3.3.X land was way too many @ on components and it started to get confusing.
                • If we are moving to just one var I think it should be "var" and not "columnVar"
                • 5. Re: What to do about the columnVar/var attributes of the pickList?
                  bleathem

                  Great, thanks for all the feedback guys!

                   

                  I've gone ahead and dropped the ability for picklist to generate it's own select items, it'll require the use of f:selectItems.  A much cleaner API overall.

                  • 6. Re: What to do about the columnVar/var attributes of the pickList?
                    healeyb

                    Can I ask if the use of f:selectItems means that there will be no rich content support in the pickList

                    component, i.e. nesting an img tag inside an option tag is not allowed by the DTD?

                     

                    Thanks.

                    • 7. Re: What to do about the columnVar/var attributes of the pickList?
                      bleathem

                      Brendan,

                       

                      Good question - you would accomplish this with a single column layout of the picklist, as in:

                       

                      <rich:pickList var="column" ...>
                          <f:selectItems ....>
                          <rich:column>
                              <img ... />
                              #{column.title}
                          </rich:column>
                      </rich:pickList>