3 Replies Latest reply on Sep 4, 2007 8:38 AM by Ilya Shaikovsky

    using a4j:jsfunction

    kewldude Newbie

      I have a rich datascroller and a rich dataTable in my page. I want to call a javascript function everytime the rich data scroller is clicked, or actually, i want to execute a javascript function after the data Scroller is clicked and the rich dataTable has been displayed (with new values). How do i do that? Is that possible at all?

        • 1. Re: using a4j:jsfunction
          Ilya Shaikovsky Master

          could you please explain the use case? why can't you perform the actions you need together with scrolling action?

          • 2. Re: using a4j:jsfunction
            kewldude Newbie

            <rich:dataTable width="100%" id="dataModelTable" rows="10" columnClasses="tableColumnCatItems" rowClasses="rowIp1,rowIp2"
            value="#{dataModel.tableModel}" var="item" binding="#{dataModel.table}" >
            <f:facet name="header">
            <h:outputText value="Description" />
            <h:outputText value="Image" />


            <h:outputText value="#{item.description}" />

            <rich:column >

            <h:graphicImage url="http://img301.imageshack.us/img211/21/intelcore2duonew.gif" width="50" height="50" />

            <rich:datascroller for="dataModelTable" maxPages="5" reRender="catGroup" renderIfSinglePage="false" />

            <a4j:jsFunction oncomplete="changeColor('test');"> </a4j:jsFunction>

            That is my code, basically what I want to do is everytime the scroller is clicked and the data is displayed by the dataTable, the changeColor javascript function should be called. The changeColor function just changes the color of the text in the screen that matches up with the method param and in this case it is the word 'test'.

            Using the jsfunction above, nothing is happening, maybe im missing something.

            • 3. Re: using a4j:jsfunction
              Ilya Shaikovsky Master

              So are you really need to make request everytime you need just change color on the client?

              just use oncomplete on the datascroller and place your function call there