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

    using a4j:jsfunction

    kewldude

      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

          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

            <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">
            <rich:columnGroup>
            <h:column>
            <h:outputText value="Description" />
            </h:column>
            <h:column>
            <h:outputText value="Image" />
            </h:column>

            </rich:columnGroup>
            </f:facet>


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


            <rich:column >

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


            <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

              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