Note that there are some explanatory texts on larger screens.

plurals
  1. POf:ajax listener not fired for h:selectBooleanCheckbox
    primarykey
    data
    text
    <p>The event doesn't get fired in my controller. This is the code.</p> <p>View: </p> <pre><code>&lt;ui:repeat var="operation" value="#{trade.operationsSortList}"&gt; &lt;tr class="operations"&gt; &lt;th class="empty_cell"&gt;&lt;/th&gt; &lt;td id="operation" class="operation_cell color"&gt;#{operation.operation}&lt;/td&gt; &lt;td class="color"&gt;#{operation.time}&lt;/td&gt; &lt;td class="color"&gt;#{operation.coment}&lt;/td&gt; &lt;td class="color"&gt; &lt;h:form&gt; &lt;h:selectBooleanCheckbox&gt; &lt;f:ajax event="click" listener="#{controller.onDelete}" /&gt; &lt;f:attribute name="trade" value="#{trade}" /&gt; &lt;/h:selectBooleanCheckbox&gt; &lt;/h:form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; </code></pre> <p>Controller:</p> <pre><code>@ManagedBean @RequestScoped public class Controller { private ArrayList trades; ..... ..... public void onDelete(AjaxBehaviorEvent event) { Trade trade = (Trade) event.getComponent().getAttributes().get("trade"); } } </code></pre> <p>Thanks in advance!</p> <p><strong>REDIT:</strong></p> <p>I got this working, but I still have problems because I have tables, so I need to wrap the tables in a form tag, so I enclose the whole view in a form tag. My goal is just to send to the server the clicked checkbox! The request is sent to the sever, but the listener doesn't get called. The javascript event gets called. This is the code:</p> <p>VIEW:</p> <pre><code> &lt;h:form&gt; &lt;table id="trades"&gt; &lt;th class="image_cell"&gt;&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Portfolio&lt;/th&gt; &lt;ui:repeat var="trade" value="#{controller.errorTrades}"&gt; &lt;tr class="trade error"&gt; &lt;td class="image_cell error"&gt;&lt;h:graphicImage styleClass="expandable" url="resources/images/plus.png"&gt;&lt;/h:graphicImage&gt;&lt;/td&gt; &lt;td id="type" class="error"&gt;#{trade.type}&lt;/td&gt; &lt;td class="error"&gt;#{trade.portfolio}&lt;/td&gt; &lt;/tr&gt; &lt;tr class="operations"&gt; &lt;td id="#{trade.murexId}" class="operation_row" colspan="4"&gt; &lt;table id="operations"&gt; &lt;tr class="header"&gt; &lt;th class="empty_cell"&gt;&lt;/th&gt; &lt;th class="operation_cell"&gt;Operation&lt;/th&gt; &lt;th&gt;Time Transaction&lt;/th&gt; &lt;th&gt;Comment&lt;/th&gt; &lt;th id="delete"&gt;Delete&lt;/th&gt; &lt;/tr&gt; &lt;ui:repeat var="operation" value="#{trade.operationsSortList}"&gt; &lt;tr class="operation"&gt; &lt;th class="empty_cell"&gt;&lt;/th&gt; &lt;td id="operation" class="operation_cell color"&gt;#{operation.operation}&lt;/td&gt; &lt;td class="color"&gt;#{operation.time}&lt;/td&gt; &lt;td class="color"&gt;#{operation.coment}&lt;/td&gt; &lt;td class="color checkbox"&gt; &lt;h:selectBooleanCheckbox title="delete"&gt; &lt;f:ajax execute="@this" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" /&gt; &lt;f:attribute name="murexId" value="#{trade.murexId}" /&gt; &lt;f:attribute name="operationId" value="#{operation.id}" /&gt; &lt;/h:selectBooleanCheckbox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; &lt;/table&gt; &lt;/h:form&gt; </code></pre> <p>CONTROLLER:</p> <pre><code>@ViewScoped public class Controller { private ArrayList trades; private ArrayList errorTrades = new ArrayList(); .......code public boolean onDelete(AjaxBehaviorEvent event) { long murexId = 0; BigDecimal operationId = null; boolean result = false; Trade trade; Iterator itop; Operation operation; ......code return true; } } </code></pre> <p>It's pretty important for me to solve this issue.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload