4 Replies Latest reply on Jun 8, 2011 2:00 AM by asc

    Search grid is not refreshing on change of right side bar

    asc

      Hi,
        
      As i am facing a problem of not refreshing the search grid of Student on change of Schools which are in the side of right block.


      In my design structure,there is a left side bar,middle part and right side bar.In right side bar there is a dropdown of Schools .on changing the value of school and saving the result,the grid should refreshed with the students list of current School,which i have set in session by changing drop down value of right side bar.


      i have tried @Create annotation on the search method of the Students,so that when we click on save it will again call the manageStudent Component with search method ,and the grid of students will get refreshed. but currently its not working,it is refreshing the grid only when i refreshed the complete page.


      Kindly give the solution if anyone have any idea about this issue.


      Thanks in advance.

        • 1. Re: Search grid is not refreshing on change of right side bar
          kragoth

          Please post your code to give us a better idea of what you are doing.

          • 2. Re: Search grid is not refreshing on change of right side bar
            asc

            I have a right side bar having code as:
            rightbar.xhtml



            <h:form id="selectSchool" style="margin: 0px 0px 0px 10px;"
                      rendered="#{identity.loggedIn and !(identity.hasRole('admin') or identity.hasRole('site-admin'))}">
                      <h:panelGrid columns="2" styleClass="none" width="100%">
                           <h:selectOneListbox id="schoolList" size="1" class="smallSelect"
                                style="border-color: grey; float:left;" value="#{navigation.schoolId}"
                                rendered="#{identity.loggedIn}">
                                <f:selectItems value="#{databaseBackedList.schoolMasterList}" />
                           </h:selectOneListbox>
                           <h:commandButton id="selectSchoolButton" style="float:right;"
                                action="#{navigation.setSchoolIdToSession}"
                                value="#{messages.btnSave}">
                                <s:conversationPropagation value="none"></s:conversationPropagation>
                           </h:commandButton>
                      </h:panelGrid>
                 </h:form>



            and the action  method which is called when i click on save button .



            @Stateful
            @Name("navigation")
            @Scope(ScopeType.SESSION)
            public class NavigationAction implements Navigation {
                 @Logger
                 private Log log;
                 @In
                 FacesMessages facesMessages;
                 private int schoolId;
            
                 public String setSchoolIdToSession() {
                         Contexts.getSessionContext().set("schoolId", schoolId);
                            redirectionInPage="students.xhtml";
                      return redirectionInPage;
                 }
            
            
                 
                 @Destroy
                 @Remove
                 public void destroy() {
                      log.info(":::::::::: Destroying Navigation Action ::::::::::");
                 }
            
                 public int getSchoolId() {
                      return schoolId;
                 }
            
                 public void setSchoolId(int schoolId) {
                      this.schoolId = schoolId;
                 }
            
            }




            and finally the component which we want with the refreshed data is manageStudent having method search



                 @SuppressWarnings("unchecked")
                 @Create
                 public void search() {
                      log.info("Enter into serach method of manage School");
                      
                      StringBuffer searchQuery = new StringBuffer(
                                "select spsl from Student spsl where spsl.flgDeleted='0' ");
                      
                      searchQuery.append(" and spsl.school.ischoolId=");
                      searchQuery.append(Contexts.getSessionContext().get("schoolId"));
                      // Check if name is filled
                      studentList = tenantEntityManager.createQuery(
                                searchQuery.toString()).getResultList();
                      log.info("Exit from serach method");
            
                 }



            and one more point that when i click on the manageStudents link which i have put in left side bar then the grid gets refreshed.
            the Code for left side bar is:



            <s:link view="/students.xhtml" propagation="none">
                                <div class="nonSelectedSideLink" id="schoolId">
                                Manage School</div>
                           </s:link>



            My main problem is fron right side bar the search grid is not refreshing.


            Thanks in advance.

            • 3. Re: Search grid is not refreshing on change of right side bar
              vikram.vikram.chhetry.gmail.com

              Ankita,


              Do you see same cid on the URL query string after saving the school in session?


              I think if you can add a new non existing cid like '0' with the redirection url, if should work. Something like below:




              redirectionInPage="students.xhtml?cid=0";
              return redirectionInPage;



              --


              Vikram

              • 4. Re: Search grid is not refreshing on change of right side bar
                asc

                Thanks Vikram.






                My issue has been resolved by implementing the solution given by you.