1 2 Previous Next 19 Replies Latest reply on May 14, 2015 10:14 AM by Prasad P

    Getting clciked row in Extended datatable

    Shivaji Byrapaneni Newbie

      Hi There,

      Im unable to get the clicked row. could any body help me pls

      here is my code snippet

      <a4j:support event="onclick" reRender="courseListEDT"
       actionListener="#{courseListBean.nominateToTheCourse}">
       <f:setPropertyActionListener value="#{course}"
       target="#{courseListBean.currentRow}" />
       </a4j:support>
       </rich:extendedDataTable>
      


      and in my backing bean i had this

      public String nominateToTheCourse(ActionEvent event) {
       final String methodName = "nominateToTheCourse";
       NominationLogger.logMethodEntry(className, methodName);
       NominationLogger.debug(courseListEDT.getSelection().toString());
       SimpleSelection sel = (SimpleSelection)courseListEDT.getSelection() ;
       NominationLogger.debug(courseListEDT.getRowData().toString());
       NominationLogger.logMethodExit(className, methodName);
       return null;
       }
      


      i can see the method getting triggered but was unable to get the row on which i made a click. property which im setting using f:setPropertyActionListener is getting set to null.

      Please help

        • 2. Re: Getting clciked row in Extended datatable
          Nick Belaevski Master

          Hi Shivaji,

          Please post page code.

          • 3. Re: Getting clciked row in Extended datatable
            Shivaji Byrapaneni Newbie

            This my page code

            <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <!-- RichFaces tag library declaration -->
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
             <h:panelGrid columns="2" columnClasses="top,top">
             <rich:messages />
             <rich:extendedDataTable value="#{nominationSessionBean.coursesList}"
             id="courseListEDT" binding="#{courseListBean.courseListEDT}"
             var="course" width="700px" height="400px" sortMode="single"
             selectionMode="single">
             <rich:column sortable="false" label="Course Image" width="40px"
             id="imageColumn" binding="#{courseListBean.imageColumn}">
             <f:facet name="header">
             <h:outputText value="" />
             </f:facet>
             <h:graphicImage value="/Images/create_doc.gif" />
             </rich:column>
             <rich:column sortable="true" sortBy="#{course.courseName}"
             filterBy="#{course.courseName}" filterEvent="onkeyup" width="170px"
             label="Course Name" id="courseNameColumn"
             binding="#{courseListBean.courseNameColumn}">
             <f:facet name="header">
             <h:outputText value="Course Name" />
             </f:facet>
             <h:outputText value="#{course.courseName}" />
             </rich:column>
             <rich:column sortable="true" sortBy="#{course.noOfSeats}"
             filterBy="#{course.noOfSeats}" filterEvent="onkeyup" width="170px"
             label="No Of Seats" id="noOfSeatsColumn"
             binding="#{courseListBean.noOfSeatsColumn}">
             <f:facet name="header">
             <h:outputText value="no Of Seats" />
             </f:facet>
             <h:outputText value="#{course.noOfSeats}" />
             </rich:column>
             <rich:column sortable="false" label="on Date" id="onDateColumn"
             binding="#{courseListBean.onDateColumn}">
             <f:facet name="header">
             <h:outputText value="on Date" />
             </f:facet>
             <h:outputText value="#{course.onDate}" />
             </rich:column>
            
             <rich:column sortable="false" label="Time" id="timeColumn"
             binding="#{courseListBean.timeColumn}">
             <f:facet name="header">
             <h:outputText value="Time" />
             </f:facet>
             <h:outputText value="#{course.courseTime}" />
             </rich:column>
            
             <rich:column sortable="false" label="location" id="locationColumn"
             binding="#{courseListBean.locationColumn}">
             <f:facet name="header">
             <h:outputText value="location" />
             </f:facet>
             <h:outputText value="#{course.location}" />
             </rich:column>
             <a4j:support event="ondblclick" reRender="courseListEDT"
             actionListener="#{courseListBean.nominateToTheCourse}">
             <f:setPropertyActionListener value="#{course}"
             target="#{courseListBean.currentRow}" />
             </a4j:support>
             </rich:extendedDataTable>
             </h:panelGrid>
            
            


            and im including thsi page into other page which is below
            <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
            <!-- RichFaces tag library declaration -->
            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
            <html>
            <head>
            <title>:: Nomination system Home ::</title>
            <script src="/NominationWeb/scripts/nominationScripts.js"
             type="text/javascript"></script>
            </head>
            <body>
            <f:view>
             <a4j:form id="nominationSystemHome"
             binding="#{homeBean.nominationSystemHome}">
             <rich:tabPanel switchType="ajax" id="nominationHometp"
             binding="#{homeBean.nominationHometp}">
             <rich:tab label="Course List" id="courseListTab"
             binding="#{homeBean.courseListTab}"
             action="#{courseListBean.loadCourseList}">
             <%@ include file="/pages/courseList.jsp"%>
             </rich:tab>
             <rich:tab label="Approve Nominations" id="approveNominationsTab"
             binding="#{homeBean.approveNominationsTab}"
             action="#{approveCoursesBean.populateCourseListToApprove}">
             <%@ include file="/pages/approveCourses.jsp"%>
             </rich:tab>
             <rich:tab label="Manage Courses" id="manageCoursesTab"
             binding="#{homeBean.manageCoursesTab}"
             action="#{manageCoursesBean.loadManageCourses}">
             <%@ include file="/pages/manageCourses.jsp"%>
             </rich:tab>
             <rich:tab label="Manage Users" id="manageUsersTab"
             binding="#{homeBean.manageUsersTab}" >
             <p>Managing users goes here.</p>
             </rich:tab>
            
             </rich:tabPanel>
             </a4j:form>
             <%@ include file="/pages/manageCourseSupport.jsp"%>
             <%@ include file="/pages/processing.jsp"%>
            </f:view>
            </body>
            </html>
            


            please help me in solving this problem

            many thanks in advance

            • 4. Re: Getting clciked row in Extended datatable
              Ilya Shaikovsky Master

              check please my mesage above.

              Also selection could be used in order to process selected rows instead of passing them as parameters.

              • 5. Re: Getting clciked row in Extended datatable
                Shivaji Byrapaneni Newbie

                Thanks for you reply

                do you mean me to replace the onclick event with onrowclick ..?

                Could you please provide me with a code sample to collect the row on which the event have been fired on...?

                many Thanks

                • 6. Re: Getting clciked row in Extended datatable
                  Shivaji Byrapaneni Newbie

                  i checked onrowclick as well and cant see the event getting fired.

                  • 7. Re: Getting clciked row in Extended datatable
                    Ilya Shaikovsky Master

                    because the name of the variable is onRowClick - in camel case as I already written. I know that this is confusing but we can't correct this because of backwards compatibility.

                    • 8. Re: Getting clciked row in Extended datatable
                      Shivaji Byrapaneni Newbie

                      i had changed the event like this

                      <a4j:support event="onrowclik" reRender="courseListEDT"
                       actionListener="#{courseListBean.nominateToTheCourse}">
                       <f:setPropertyActionListener value="#{course}"
                       target="#{courseListBean.currentRow}" />
                       </a4j:support>
                       </rich:extendedDataTable>
                      
                      


                      still i cant see the action getting called in the sense event fire is not happening.

                      • 9. Re: Getting clciked row in Extended datatable
                        panky_p Novice

                        Spell properly the event onRowClick .

                        <a4j:support event="onRowClick" reRender="courseListEDT"
                         actionListener="#{courseListBean.nominateToTheCourse}">
                         <f:setPropertyActionListener value="#{course}"
                         target="#{courseListBean.currentRow}" />
                         </a4j:support>
                         </rich:extendedDataTable>
                        
                        


                        • 10. Re: Getting clciked row in Extended datatable
                          Ilya Shaikovsky Master

                          read please my post above carefully.

                          • 11. Re: Getting clciked row in Extended datatable
                            Shivaji Byrapaneni Newbie

                            cheers it helped out

                            im even able to get the selected row

                            but i want the event to be fired on row double clcik..

                            could you please help me on this as well...?

                            • 12. Re: Getting clciked row in Extended datatable
                              Ilya Shaikovsky Master

                              just change the event to corresponding one. tlddocs and dev guide could be very helpful to get such info like proper attributes names.

                              • 14. Re: Getting clciked row in Extended datatable
                                panky_p Novice

                                sorry for last wrong post use onRowDblClick

                                1 2 Previous Next