코드가 표시 될 때 중첩 테이블을 몇 개 있습니다. 사용자가 체크 박스를 클릭하면 서버로 ajax 호출이 전송 된 다음 클라이언트로 다시 전달됩니다. 서버의 프로세스가 올바르게 작동하면 클릭 된 작업 행은 콜백을받을 때 jquery를 사용하여 html 코드에서 제거됩니다. 그런 다음 사용자가 동일한 작업 테이블에서 다른 행을 삭제하려고하면 서버에 전송되는 값은 이 아니며입니다. 호출은 다음 행 값을 전송합니다. # {trade.murexId}, # {operation.id} 및 # {operation.operation}이지만 은 올바른 번호가 아닙니다.이 올바른 것입니다. Javascript 및 jquery 콜백 함수가 제대로 작동하고 있습니다. Mojarra의 마지막 버전을 사용하고 있습니다. 왜 이런 일이 일어 났습니까? 어떻게 해결할 수 있습니까?JSF 2. h : selectBooleanCheckbox. 예기치 않은 동작
HTML : 사전에
<table id="trades">
<th class="image_cell"></th>
<th>Murex Id</th>
<th>Type</th>
<th>Portfolio</th>
<th>Log</th>
<ui:repeat var="trade" value="#{controller.errorTrades}">
<h:form>
<tr class="trade error">
<td class="image_cell error"><h:graphicImage styleClass="expandable" url="resources/images/plus.png"></h:graphicImage></td>
<td id="murex_id" class="error">#{trade.murexId}</td>
<td id="type" class="error">#{trade.type}</td>
<td class="error">#{trade.portfolio}</td>
<td class="error">
<h:commandButton image="resources/images/log_big.jpg" action="#{controller.onLogTrade(trade.murexId)}">
<f:ajax render="log_big" />
</h:commandButton>
<h:panelGroup id="log_big">
<h:outputScript rendered="#{not empty controller.result}">
onLogProcess("#{controller.result}");
</h:outputScript>
</h:panelGroup>
</td>
</tr>
<tr class="operations">
<td id="#{trade.murexId}" class="operation_row" colspan="5">
<table id="operations">
<tr class="header">
<th class="empty_cell"></th>
<th class="operation_cell">Operation</th>
<th>Murex Status</th>
<th>GBO Status</th>
<th>GBO Id</th>
<th>OPICS Id</th>
<th>Time Transaction</th>
<th>Comment</th>
<th id="delete">Delete</th>
<th>Log</th>
</tr>
<ui:repeat var="operation" value="#{trade.operationsSortDescList}" varStatus="status">
<tr class="operation">
<th class="empty_cell"></th>
<td id="operation" class="operation_cell color">#{operation.operation}</td>
<td class="color">#{operation.statusMurex}</td>
<td id="status_gbo" class="color">#{operation.statusGbo}</td>
<td id="gbo_id" class="color">#{operation.gboId}</td>
<td id="opics_id" class="color">#{operation.opicsId}</td>
<td class="color">#{operation.datetimeToString}</td>
<td class="color">#{operation.coment}</td>
<td class="color checkbox">
<h:selectBooleanCheckbox>
<f:ajax execute="@form" event="click" listener="#{controller.onDelete}" onevent="onDeleteProcess" />
<f:attribute name="murexId" value="#{trade.murexId}" />
<f:attribute name="operationId" value="#{operation.id}" />
<f:attribute name="operation" value="#{operation.operation}" />
</h:selectBooleanCheckbox>
</td>
<td class="color log">
<h:commandButton image="resources/images/log_small.jpg" action="#{controller.onLogOperation(operation)}">
<f:ajax execute="@form" render="small_log" />
</h:commandButton>
<h:panelGroup id="small_log">
<h:outputScript rendered="#{not empty controller.result}">
onLogProcess("#{controller.result}");
</h:outputScript>
</h:panelGroup>
</td>
</tr>
</ui:repeat>
</table>
</td>
</tr>
</h:form>
</ui:repeat>
</table>
감사합니다!
재 편집 : 시간에 selectBooleanCheckbox : 내가 시간을 변경
있는 명령.
보기 :
<table id="operations">
<tr class="header">
<th class="empty_cell"></th>
<th class="operation_cell">Operation</th>
<th>Murex Status</th>
<th>GBO Status</th>
<th>GBO Id</th>
<th>OPICS Id</th>
<th>Time Transaction</th>
<th>Comment</th>
<th id="delete">Delete</th>
<th>Log</th>
</tr>
<ui:repeat var="operation" value="#{trade.operationsSortDescList}" varStatus="status">
<tr class="operation">
<th class="empty_cell"></th>
<td id="operation" class="operation_cell color">#{operation.operation}</td>
<td class="color">#{operation.statusMurex}</td>
<td id="status_gbo" class="color">#{operation.statusGbo}</td>
<td id="gbo_id" class="color">#{operation.gboId}</td>
<td id="opics_id" class="color">#{operation.opicsId}</td>
<td class="color">#{operation.datetimeToString}</td>
<td class="color">#{operation.coment}</td>
<td class="color checkbox">
<h:commandButton image="resources/images/log_small.jpg" action="#{controller.onDelete(operation)}">
<f:ajax execute="@form" render="small_log" onevent="onDeleteProcess" />
</h:commandButton>
</td>
<td class="color log">
<h:commandButton image="resources/images/log_small.jpg" action="#{controller.onLogOperation(operation)}">
<f:ajax execute="@form" render="small_log" />
</h:commandButton>
<h:panelGroup id="small_log">
<h:outputScript rendered="#{not empty controller.result}">
onLogProcess("#{controller.result}");
</h:outputScript>
</h:panelGroup>
</td>
</tr>
</ui:repeat>
</table>
컨트롤러 : 나는 작업을 삭제하면
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);
}
}
, 그것이 문제입니다. jquery 때문에 안돼. 나는 그것을 테스트했기 때문에 그것에 대해 확신합니다. 작업을 삭제하고 다음 작업을 클릭하면 서버에 잘못된 작업이 전송됩니다. 왜 이런 일이 일어나는 지 아십니까?
감사합니다.
아니요, 그 때문이 아닙니다. 위 내 응답을 확인하십시오. 감사! @eljunior – bribon