如何使一个列在readonly ace中可编辑:datatable?

时间:2015-09-16 09:34:09

标签: jsf datatable icefaces

我有一个由4列

组成的只读ace:datatable

我希望制作第四栏" 流程限制"可在此数据表中编辑

我可以这样做吗?

这是xhtml代码:

<ace:dataTable value="#{bankProcessLimitManagement.bankProcessLimitBean}"
                    var="name" style="width: 50% !important;" id="namesTable"
                    rowSelectListener="#{bankProcessLimitManagement.rowSelectListener}"
                    rowUnselectListener="#{bankProcessLimitManagement.rowDeSelectListener}"
                    selectionMode="single" paginator="true" rows="10">
                    <ace:column headerText="LatinName">
                        <h:outputText value="#{name.latinName}"></h:outputText>
                    </ace:column>
                    <ace:column headerText="Arabic Name">
                        <h:outputText value="#{name.arabicName}"></h:outputText>
                    </ace:column>
                    <ace:column headerText="Process Type">
                        <h:outputText value="#{name.processType}"></h:outputText>
                    </ace:column>
                    <ace:column headerText="Process Limit">
                        <h:outputText value="#{name.limit}"></h:outputText>
                    </ace:column>
</ace:dataTable>

这是对应的bean:

@ManagedBean(name="bankProcessLimitManagement")
@ViewScoped
public class BankProcessLimitManagement {
    // Render for the datatable
    private boolean renderTable = false;
    // List linked to the datatable
    private List<BankProcessLimitBean> bankProcessLimitBean;
    // Selected Row
    private BankProcessLimitBean selectedBankProcessLimit;
    public void rowSelectListener(SelectEvent event) {
        selectedBankProcessLimit = (BankProcessLimitBean) event.getObject();
    }
    public void rowDeSelectListener(UnselectEvent event) {
        selectedBankProcessLimit = null;
    }
    // Getters
    public List<BankProcessLimitBean> getBankProcessLimitBean() { return bankProcessLimitBean; }
    public boolean isRenderTable() { return renderTable; }
    public BankProcessLimitBean getSelectedBankProcessLimit() { return selectedBankProcessLimit; }

    // Setters
    public void setRenderTable(boolean renderTable) { this.renderTable = renderTable; } 
    public void setBankProcessLimitBean(List<BankProcessLimitBean> bankProcessLimitBean) { this.bankProcessLimitBean = bankProcessLimitBean; }
    public void setSelectedBankProcessLimit(BankProcessLimitBean selectedBankProcessLimit) { this.selectedBankProcessLimit = selectedBankProcessLimit; }    
}

提前致谢

1 个答案:

答案 0 :(得分:1)

documentation中所说,你应该这样做:

<ace:column headerText="Process Limit">
    <ace:cellEditor>
        <f:facet name="output">
            <h:outputText value="#{name.limit}"/>
        </f:facet>
        <f:facet name="input">
            <h:inputText value="#{name.limit}"/>
        </f:facet>
    </ace:cellEditor>
</ace:column>

您当然需要添加包裹表格的表单,并包含按钮或链接以提交数据。