2 Replies Latest reply on Mar 16, 2010 7:33 AM by nimo stephan

    onRowClick and ajaxSingle

    nimo stephan Master

      I want to select a row from an extendedDatatable via onRowClick:

       

      I use the following code, which works!

       

      However, I want to reRender only the rich:contextMenu after selecting a row,

      so I wanted to use the property 'ajaxSingle' when onRowClick is called.

      But when using 'ajaxSingle', then the action myBean.selectUser(u) is no more fired.

       

      <h:form id="formTable">

      <rich:extendedDataTable value="#{myBean.users}" var="u" height="100px">

       

      <rich:column>

        ..

      </rich:column>

      ..

      <!-- myBean.selectUser(u) is only fired, when removing ajaxSingle=true -->

      <a4j:support event="onRowClick"

      action="#{myBean.selectUser(u)}"
      reRender="contextMenu"
      limitToList="true"

      ajaxSingle="true"

      oncomplete="#{rich:component('formMenu:contextMenu)}.show(event, {name: '#{u.username}'})"/>

       

      </rich:extendedDataTable>

      </h:form>


      <h:form id="formMenu">

      <rich:contextMenu attached="false" id="contextMenu"  submitMode="ajax" hideDelay="0" showDelay="0">
                   <rich:menuItem value="Details: {name}"  reRender="viewUser" limitToList="true"  ajaxSingle="true"/>
      ..

      </rich:contextMenu>

      </h:form>

       

      Why can I not use ajaxSingle=true?

        • 1. Re: onRowClick and ajaxSingle
          Ilya Shaikovsky Master
          in general ajaxSingle not affects reRender.. It just limits processing. if you need to limit rendering use limittolist="true"
          1 of 1 people found this helpful
          • 2. Re: onRowClick and ajaxSingle
            nimo stephan Master

            Okay I do not use ajaxSingle=true, then action is fired.

             

            The problem was,

            I had one h:form, within the form was rich:extendedDatatable and rich:contextMenu.

             

            The rich:extendedDatatable has its build in scrollbar and when I scroll down (for example: to the row 100)

            and click that row, then contextMenu shows up,

            but the rich:extendedDatatable reRenders again and jumps automatically to the beginning of the datatable

            (so I have to scroll down again and search the 'row 100' which was clicked by me).

             

            Now, I am using two forms, one for rich:extendedDatatable and the other for rich:contextMenu - this solved my problem.