2 Replies Latest reply on Jul 31, 2007 12:08 PM by jlane

    EntityQuery Ajax update

      Could someone please explain the steps necessary to have ajax update the input fields and rerun the query.

      I have the entityquery running correctly when you enter text in a field and press the submit button - refreshing the datatable.

      What I am trying to do is change the behavior to where as the user is entering keystrokes into the input fields the parameters are updated and the query is then rerun - updateing the datatable and re-rendered.

      I have been successful in creating an ajax method call per keystroke but don't know how to update the query parameters and re-run the query.

      <h:inputText id="classTitle" value="#{staffCourseList.staffCourse.classTitle}" style="width: 165px;">
      <a:support event="onkeyup" actionListener="#{staffCourseList.find}" />
      </h:inputText>
      <a:commandButton id="submit" value="Find Course" action="#{staffCourseList.find}" reRender="dataTableStaffCourseList"/>


      Thanks for your help.

        • 1. Re: EntityQuery Ajax update
          damianharvey

          You're almost there (assuming that the button refreshes the table correctly). In your a:support tag change it to:

          <a:support event="onkeyup" action="#{staffCourseList.find}" reRender="dataTableStaffCourseList"/>


          This will update the value of classTitle in your Bean with each keystroke. Assuming that your dataTable is populated with a query that uses this parameter, then it will work fine.

          Cheers,

          Damian.

          • 2. Re: EntityQuery Ajax update

            Thanks Damian - that worked the first time.

            I had the reRender in the command button but not in the a:support. After making that change it worked perfectly.

            Thanks for taking the time to have a look.

            Regard, John