5 Replies Latest reply on Mar 18, 2011 10:32 AM by balteo

    Basic question about rich:dataGrid

    balteo

      Hello,

       

      I have used a rich:dataGrid in my application for quite a while and I am wondering if I could add one "hard-coded" element as the last element of my dataGrid regardless of the number of elements in the "values" attribute.

       

      So if I have 5 elements in my dataGrid's "values" variable, I would have 5+1=6 elements in all. Moreover the last element would not have the same attributes as the "var" variable.

       

      I know that seems a lot to ask but it would be great if I could achieve that.

       

      Any clue or workaround welcome.

       

      Thanks in advance,

       

      Julien Martin.

        • 1. Basic question about rich:dataGrid
          boy18nj

          Sure you can do it if you are using multiple rich:panel's inside rich:dataGrid, then you can add a one panel with hard coded values instead of using  var.

          Let me know if it makes sense.

          • 2. Basic question about rich:dataGrid
            balteo

            Hello Aman,

            Thanks. Unfortunately it does not work.

             

            Here is the code:

                       <rich:dataGrid value="#{galerieView.sculptures}" var="sculpture" columns="3" styleClass="datagrid-galerie">

                                    <div>

                                        <p>

                                            <pretty:link mappingId="sculptureAction" styleClass="miniature-link">

                                                <f:param value="#{view.locale.language}"/>

                                                <f:param value="#{jbm:normaliserURL(sculpture.sculpturei18nMap[view.locale.language].titre)}" />

                                                <f:param value="#{sculpture.sculptureID}" />

                                                <h:graphicImage value="#{initParam['com.jeanbaptistemartin.static.url']}/#{sculpture.photoMiniature}" styleClass="miniature-image" alt="#{sculpture.sculpturei18nMap[view.locale.language].titre}, #{sculpture.sculpturei18nMap[view.locale.language].matiere}, #{jbm:renvoyerAnnee(sculpture.annee)}."/>

                                            </pretty:link>

                                        </p>

                                        <p>

                                            <pretty:link mappingId="sculptureAction" styleClass="miniature-link-text">

                                                <f:param value="#{view.locale.language}"/>

                                                <f:param value="#{jbm:normaliserURL(sculpture.sculpturei18nMap[view.locale.language].titre)}" />

                                                <f:param value="#{sculpture.sculptureID}" />

                                                <h:outputText value="#{sculpture.sculpturei18nMap[view.locale.language].titre}, " />

                                                <h:outputText value="#{sculpture.sculpturei18nMap[view.locale.language].matiere}" />

                                            </pretty:link>

                                        </p>

                                    </div>

                                    <rich:panel>

                                        toto

                                    </rich:panel>

                                </rich:dataGrid>

             

            The <rich:panel> is outputted as many times as the number of elements in the "value" attribute...

            Any other idea?

            J.

            • 3. Basic question about rich:dataGrid
              ilya_shaikovsky

              Just craete new list which will be used as your grid value which will consist of your original list and one additional item. It will be transparet for your other code related to that original list and in the same time will allow you to draw one more fake panel.

               

              if need to use different markup at all for that last cell use conditional rendering and use iterationVar attribute for condition definition. e.g. checking that it's last cell is:

              ...

              iterationVar="iter"

              ...

              rendered="#{iter.last}"

              • 4. Basic question about rich:dataGrid
                boy18nj

                that's right...

                • 5. Basic question about rich:dataGrid
                  balteo

                   

                  Thanks a lot Ilya. It works!!

                  Thanks to you too Aman.

                  J.