dako-ak
dako-ak

Reputation: 13

RichFaces, extendedDataTable: avoid selectionChange event on double click

I have an extendedDataTable with a selectionchange event and selectionMode="single". Furthermore I work with the attribute "onrowdblclick" wich invokes a JavaScript function.

<rich:extendedDataTable id="myTable" ... selectionMode="single" var="item" selection="#{myController.selection}" onrowdblclick="showPageByDoubleClick('#{item.id}');"> 

<a4j:ajax event="selectionchange" listener="..."/>

My question is, how can I prevent the extendedDataTable from invoking the selectionchange event if the user has double clicked a row?

On double click I forward to a new page and the selectionchange event takes too much time, thus the page forwarding is delayed. We have very strict performance requirements.

I'am using RichFaces 4.5.9

Best regards

Upvotes: 0

Views: 518

Answers (1)

dako-ak
dako-ak

Reputation: 13

Ok, everything I had to do is to work with a queue and to group both requests in one queue. The queue treats both requests as the same request and thus the ignoreDupResponses attribute is working.

Example:

<h:form id="myform">
  <a4j:queue name="overviewSelectionQueue" ignoreDupResponses="true" requestDelay="200"/>

<a4j:jsFunction name="editWithDoubleClick" action="#{myController.editWithDoubleClick}">

    <a4j:param name="selectedId" assignTo="#{myController.selectedId}" />
    <a4j:attachQueue name="overviewSelectionQueue" requestGroupingId="overviewSelection"/>
</a4j:jsFunction>

<rich:extendedDataTable id="myTable" value="#{myController.myList}" var="item" selectionMode="single"

                        selection="#{myController.selection}" onrowdblclick="editWithDoubleClick('#{item.id}');">

      <a4j:ajax event="selectionchange" listener="#{myController.overviewTableSelectionChanged}"
           execute="@this" limitRender="true">
           <a4j:attachQueue name="overviewSelectionQueue" requestGroupingId="overviewSelection"/>
      </a4j:ajax>
...

Upvotes: 1

Related Questions