Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF 2. h:selectBooleanCheckbox. Unexpected behavior
    primarykey
    data
    text
    <p>I have a couple of nested tables as the code shows. When a user click a checkbox, the ajax call is sent to the server and then back to the client. If the process in the server is working correctly, the clicked operation row is removed from the html code using jquery when it gets the callback. Then when user tries to delete another row in the <strong>same operations table</strong>, the values that are sent to the server are <strong>NOT</strong> correct. <strong>The call sends next row values</strong>: #{trade.murexId}, #{operation.id} and #{operation.operation}, but <strong>NOT</strong> the right ones. Javascript and jquery callback functions are working properly. I'm using last version of Mojarra. Why this happened? and How can I solve it?</p> <p>HTML:</p> <pre><code> &lt;table id="trades"&gt; &lt;th class="image_cell"&gt;&lt;/th&gt; &lt;th&gt;Murex Id&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Portfolio&lt;/th&gt; &lt;th&gt;Log&lt;/th&gt; &lt;ui:repeat var="trade" value="#{controller.errorTrades}"&gt; &lt;h:form&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="murex_id" class="error"&gt;#{trade.murexId}&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;td class="error"&gt; &lt;h:commandButton image="resources/images/log_big.jpg" action="#{controller.onLogTrade(trade.murexId)}"&gt; &lt;f:ajax render="log_big" /&gt; &lt;/h:commandButton&gt; &lt;h:panelGroup id="log_big"&gt; &lt;h:outputScript rendered="#{not empty controller.result}"&gt; onLogProcess("#{controller.result}"); &lt;/h:outputScript&gt; &lt;/h:panelGroup&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="operations"&gt; &lt;td id="#{trade.murexId}" class="operation_row" colspan="5"&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;Murex Status&lt;/th&gt; &lt;th&gt;GBO Status&lt;/th&gt; &lt;th&gt;GBO Id&lt;/th&gt; &lt;th&gt;OPICS Id&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;th&gt;Log&lt;/th&gt; &lt;/tr&gt; &lt;ui:repeat var="operation" value="#{trade.operationsSortDescList}" varStatus="status"&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.statusMurex}&lt;/td&gt; &lt;td id="status_gbo" class="color"&gt;#{operation.statusGbo}&lt;/td&gt; &lt;td id="gbo_id" class="color"&gt;#{operation.gboId}&lt;/td&gt; &lt;td id="opics_id" class="color"&gt;#{operation.opicsId}&lt;/td&gt; &lt;td class="color"&gt;#{operation.datetimeToString}&lt;/td&gt; &lt;td class="color"&gt;#{operation.coment}&lt;/td&gt; &lt;td class="color checkbox"&gt; &lt;h:selectBooleanCheckbox&gt; &lt;f:ajax execute="@form" 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;f:attribute name="operation" value="#{operation.operation}" /&gt; &lt;/h:selectBooleanCheckbox&gt; &lt;/td&gt; &lt;td class="color log"&gt; &lt;h:commandButton image="resources/images/log_small.jpg" action="#{controller.onLogOperation(operation)}"&gt; &lt;f:ajax execute="@form" render="small_log" /&gt; &lt;/h:commandButton&gt; &lt;h:panelGroup id="small_log"&gt; &lt;h:outputScript rendered="#{not empty controller.result}"&gt; onLogProcess("#{controller.result}"); &lt;/h:outputScript&gt; &lt;/h:panelGroup&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/h:form&gt; &lt;/ui:repeat&gt; &lt;/table&gt; </code></pre> <p>Thanks in advance!</p> <p><strong>REEDIT:</strong></p> <p>I changed h:selectBooleanCheckbox to h:commandButton.</p> <p>View:</p> <pre><code> &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;Murex Status&lt;/th&gt; &lt;th&gt;GBO Status&lt;/th&gt; &lt;th&gt;GBO Id&lt;/th&gt; &lt;th&gt;OPICS Id&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;th&gt;Log&lt;/th&gt; &lt;/tr&gt; &lt;ui:repeat var="operation" value="#{trade.operationsSortDescList}" varStatus="status"&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.statusMurex}&lt;/td&gt; &lt;td id="status_gbo" class="color"&gt;#{operation.statusGbo}&lt;/td&gt; &lt;td id="gbo_id" class="color"&gt;#{operation.gboId}&lt;/td&gt; &lt;td id="opics_id" class="color"&gt;#{operation.opicsId}&lt;/td&gt; &lt;td class="color"&gt;#{operation.datetimeToString}&lt;/td&gt; &lt;td class="color"&gt;#{operation.coment}&lt;/td&gt; &lt;td class="color checkbox"&gt; &lt;h:commandButton image="resources/images/log_small.jpg" action="#{controller.onDelete(operation)}"&gt; &lt;f:ajax execute="@form" render="small_log" onevent="onDeleteProcess" /&gt; &lt;/h:commandButton&gt; &lt;/td&gt; &lt;td class="color log"&gt; &lt;h:commandButton image="resources/images/log_small.jpg" action="#{controller.onLogOperation(operation)}"&gt; &lt;f:ajax execute="@form" render="small_log" /&gt; &lt;/h:commandButton&gt; &lt;h:panelGroup id="small_log"&gt; &lt;h:outputScript rendered="#{not empty controller.result}"&gt; onLogProcess("#{controller.result}"); &lt;/h:outputScript&gt; &lt;/h:panelGroup&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ui:repeat&gt; &lt;/table&gt; </code></pre> <p>Controller:</p> <pre><code>public void onDelete(Operation operation) { Trade trade = operation.getTrade(); Boolean result = false; try { if (trade.getOperations().size() == 1) { result = Modelo.deleteTrade(trade); if (result) this.trades.remove(trade); } else { result = Modelo.deleteOperation(operation); if (result) trade.getOperations().remove(operation); } } catch(Exception ex) { ConfigUtil.LOGGER.error(ex); } </code></pre> <p>}</p> <p>When I delete an operation, it's the problem. No because of jquery. I'm sure about that because I tested it. When I delete an operation and click the next operation, it sends to the server the wrong operation. Any idea why this is happening?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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