禁用数据表IceFace中的特定行

时间:2016-08-08 08:13:20

标签: javascript spring jsf icefaces

我有一个屏幕,其中显示某些数据。我使用datatable选项显示数据和rowselector来选择行。 如果我选择任何行,会弹出一个选项,用户可以通过该选项操作数据(如编辑和删除),但我希望某些数据不可编辑。

我有一个屏幕,其中我按月显示数据,如果当前月份是8月,那么我的页面将显示前两个月的数据和下一个10个月的数据。

现在我希望当前月份和前两个月的数据不可编辑或禁用,同时选择行到行选择器。 enter image description here

下面是我的View页面和rowselector函数:

 <i:dataTable id="ConfigurationOne"
            headerClass="dataTableCommonHeader"
        headerClasses="table_header"
        columnClasses="stringColumn, stringColumn w80"
        rowClasses="level2ColorStyle, level1ColorStyle"
        value="#{configOneBean.monthsDateList}" var="row" cellpadding="0"
        cellspacing="1" columnWidths="50px,100px" rows="25"
        width="40%"
        onrowmouseover="this.style.cursor='default';this.style.backgroundColor='#F1F1F1'‌​;" 
        onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
        >

        <i:column>
            <i:rowSelector value="#{row.selected}" 
                selectionListener="#{configOneBean.rowSelectMonthsListener}" />
            <f:facet name="header">
                <i:outputText value="#{resApp['config.type.code']}" />
            </f:facet>
            <i:panelGroup style="width:200px;overflow:hidden;">
                <i:outputText value="#{row.NRPV_NRPA_CODE}" />
            </i:panelGroup>
        </i:column>

        <i:column>

            <f:facet name="header">
                <i:outputText value="#{resApp['config.type.name']}" />
            </f:facet>
            <i:panelGroup style="width:200px;overflow:hidden;">
                <i:outputText value="#{row.NRPV_CREATED_BY}" />
            </i:panelGroup>
        </i:column>



    </i:dataTable>
public void rowSelectMonthsListener(RowSelectorEvent event) {
    int selectRow = event.getRow();
    initActionMap();
    if (event.isSelected()) {

        this.monthsDate = monthsDateList.get(selectRow);
        getAllMonthsAndDate();
        actionMap.put(WorkMode.EDIT_GROUP, true);

    } else {

        this.monthsDate = null;
        workMode = WorkMode.EMPTY;
    }
}

1 个答案:

答案 0 :(得分:0)

rowSelector组件确实具有rendered属性。如果将它绑定到一个方法来确定是否可以单击该行,这应该可以解决问题。并不是说我没有在我的代码中尝试这个属性,但是如果没有错误的话,应该工作。

相关问题