4 Replies Latest reply on Sep 18, 2014 2:18 AM by Asim Shaikh

    How to add total row count and change count on dropdown change ??

    Asim Shaikh Novice

      I wanted to add Total count of row and Change the count on dropdown change

       

      <h:selectOneMenu id="yearFilterSelectOneMenuOrder" value="#{orderMaster.homePageYearFilter}">

                                                                      <f:selectItems value="#{orderMaster.yearSelectItemsList}" />

                                                                      <f:ajax event="change" render="orderhometable searchDateCalendarorders monthFilterSelectOneMenuOrder yearFilterSelectOneMenuOrder dataScrollerPanelorder" listener="#{orderMaster.homePageSearchByMonthAndYear()}" />

      </h:selectOneMenu>

       

       

      <rich:dataTable  value="#{orderMaster.outputList}" var="order" rowKeyVar="index" id="orderhometable"

                                                                               rows="10" style="width:100%;border: 2px;" rowClasses="even-row, odd-row">

       

                                                                  <rich:column style="width:2%;" id="ordersrnocount">

                                                                      <f:facet name="header">Sr.No</f:facet>

                                                                      <h:outputText value="#{index + 1}" />

                                                                  </rich:column>

                                                                  <rich:column style="width:6%;" id="ordercol1">

                                                                      <f:facet name="header">#{lbl['label.orderdate']}</f:facet>

                                                                      <h:outputText value="#{order.orderDateString}" id="ordertxt1"/>

                                                                  </rich:column>

       

                                                                  <rich:column style="width:35%;" id="ordercol4">

                                                                      <f:facet name="header">#{lbl['label.desc']}</f:facet>

                                                                      <h:outputText value="#{order.orderDesc}" id="ordertxt4"/>

                                                                  </rich:column>

       

                                                              </rich:dataTable>

        • 1. Re: How to add total row count and change count on dropdown change ??
          liumin hu Master

          hi,

           

          You need put something more. The short answer is retrun the rowcount in your backingbean.

          • 2. Re: How to add total row count and change count on dropdown change ??
            Asim Shaikh Novice

            I have DropDown year displays record of that year  event="change" Now I want to add one more dropdown  or Text box which display total no of reocrds(i.e total no of rows) when Year change the another dropdown will display no of records for that year

            • 3. Re: How to add total row count and change count on dropdown change ??
              liumin hu Master

              You can just creat a getter :

               

              public string getRecordCount(){

                   return this.outputList.size();

              }

               

              and put it somewhere in your page.

              <h:outputText value="#{orderMaster.recordCount}" />

               

              I dont understand why you need a dropdown.

              • 4. Re: How to add total row count and change count on dropdown change ??
                Asim Shaikh Novice

                Hi liumin hu

                Thanx for the answer bro...

                I have following changes in the programme and it works absolutely fine

                 

                 

                 

                private Integer recordCount;

                 

                public Integer getRecordCount() {

                        return this.outputList.size();

                    }

                 

                    public void setRecordCount(Integer recordCount) {

                        this.recordCount = recordCount;

                    }

                 

                 

                <h:selectOneMenu id="yearFilterSelectOneMenuOrder" value="#{orderMaster.homePageYearFilter}">

                                                                                <f:selectItems value="#{orderMaster.yearSelectItemsList}" />

                                                                                <f:ajax event="change" render="orderhometable searchDateCalendarorders ordersrecordcount monthFilterSelectOneMenuOrder yearFilterSelectOneMenuOrder dataScrollerPanelorder" listener="#{orderMaster.homePageSearchByMonthAndYear()}" />

                            

                                                              </h:selectOneMenu>

                 

                <h:outputText value=" #{orderMaster.recordCount}"  id="ordersrecordcount" />

                 

                Thank you once again@liumin hu