3 Replies Latest reply on Oct 23, 2009 5:02 PM by sburgula1

    Rich Datatable row selection issue

      I have implemented a rich:datatable with the capability that when you click on a row, the selected row details are displayed in a separate page.

      <rich:panel>
        <rich:dataTable id="table" value="#{courseSearch.courseResultList}" var="var"
                rows="20" sortMode="single"
                onRowMouseOver="this.style.backgroundColor='#FFFFAA'"
                   onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                                                                                      <a4j:support action="#{courseSearch.loadCourseOffering()}" event="onRowClick">
                       <f:setPropertyActionListener value="#{var}"
                                 target="#courseSearch.selectedCourse}" />
                                   <s:conversationPropagation type="join"/>
                   </a4j:support>
                 followed by rich:columns

             </rich:dataTable>
        <rich:panel>


      In the backing bean, I have getSelectedCourse and setSelectedCourse

              public void setSelectedCourse(CourseOffering selectedCourse) {
                this.selectedCourse = selectedCourse;
           }

           public CourseOffering getSelectedCourse() {
                     
                return selectedCourse;
           }


      This is the backing bean  method being called.
                public String loadCourseOffering() {

                //System.out.println("Entered loadCourseOffering");
                String returnView = null;
                
                if (selectedCourse != null) {
                     courseoffering = courseDao.getCourseOffering(selectedCourse);
                }
                
                
                if(courseoffering != null){
                     mode="view";
                     returnView = "viewCourse";
                     return returnView;
                     

                }
                else{
                     return returnView;
                     
                     
                }
           
                
           }



      NOW THE PROBLEM  IS I search for something the datatable gives me 20 rows of data.  I click on it the first time, the selected row details are not shown.  But if I click on another button on the page and come back to this SEARCH page, and then click on the row, the row data appears.

      Please let me know what the problem is, as I am having this problem since a long time and NOT able to find out what is causing this problem.


      thanks
      Sai