1

私はデータテーブルを持っています、各行には

<p:commandButton styleClass="edit-promo-img" action="#{branchController.prepareEdit}" value="" oncomplete="updateBranchForm()"/>

これは私のモーダルです:

<div id="edit-branch-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <h:form id="editBranchForm">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            Branch Details
        </div>
        <div class="modal-body">
            <div><h:outputLabel value="#{bundle.CreateBranchLabel_name}" for="name" /></div>
            <div><h:inputText id="name" value="#{branchController.selected.name}" title="#{bundle.CreateBranchTitle_name}" required="true" requiredMessage="#{bundle.CreateBranchRequiredMessage_name}"/></div>
        </div>
        <div class="modal-footer">
            <p:commandButton action="#{branchController.update}" value="#{bundle.CreateBranchSaveLink}" />
            <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
        </div>
        <p:remoteCommand name="updateBranchForm" update="@form" />
    </h:form>

prepareEditメソッド:

public void prepareEdit() {
    current = (Branch) getItems().getRowData();
    selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
}

選択した方法:

public Branch getSelected() {
    if (current == null) {
        current = new Branch();
        selectedItemIndex = -1;
    }
    return current;
}

getSelectedメソッドでデバッグすると、「現在の」オブジェクトに実際に正しいデータがあります。

私の問題は、モーダルの入力にデータがないことです。

PrimefacesでJSF2.0を使用していて、私のBeanはViewScopeを使用しています。

4

0 に答える 0