为数据表分配行号

时间:2015-09-08 05:38:21

标签: primefaces datatable

我有桌子为不同级别的学生保存座位计划。 假设在1号房间分配了5名1级学生。对于该行号,将为1到5。 其他5名同级别的学生被分配到2号房间, 这个行号必须是6到10.我正在使用
   <h:outputText value= "#{rowIndex+1}"/>  显示行号。但是使用它,行号再次是1到5。  怎么办?我的代码是这样的。

<p:dataTable id="tblStudents" style="margin-top:4px"
                            value="#{seatPlanGenerationMB.lstRegistration}"
                            selection="#{seatPlanGenerationMB.lstSelectedExamRegistration}"
                            paginator="true" rows="20"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                            rowsPerPageTemplate="20,40,60" rowIndexVar="rowsn" var="student"
                            resizableColumns="true" scrollable="true" scrollHeight="230"
                            rowKey="#{student.registrationId}" rowStyleClass="#{rowsn le 1975 ? 'colored' : null}">
                            <p:column width="15">
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.sn}" />
                                </f:facet>
                                <h:outputText value="#{rowsn+1}" style="float:right;" />
                            </p:column>
                            <p:column headerText="Reg No." width="20"
                                style="text-align:center">
                                <h:outputText value="#{student.stuLevelModel.regNo}"
                                    style="float:right;" />
                            </p:column>
                            <p:column headerText="Student Name" width="50">
                                <h:outputText
                                    value="#{student.stuLevelModel.studentModel.studentName}" />
                            </p:column>
                                <p:column headerText="subject" width="70">
                                <h:outputText value="#{student.examSubModel.subjectName}" />
                            </p:column>
                            <p:column headerText="Paper" width="20">
                                <h:outputText value="#{student.testpaperCodevaluModel.cvLbl==null?'':student.testpaperCodevaluModel.cvLbl}" />
                            </p:column>

                            <p:column style="text-align:center" selectionMode="multiple"
                                width="10">
                            </p:column>
                        </p:dataTable>

如果已经保存了5个1级学生,那么在2号房间加载相同级别的数据时,行号必须从6开始。

我加载组合的代码是这样的:

<h:panelGrid columns="2">
        <h:outputText value="Level  *" style="font-weight:bold;" />
        <p:selectOneMenu id="cmbLevel"   value="#seatPlanGenerationMB.levelModel.levelId}"
        required="true" style="width:180px;">
        <f:selectItem itemLabel="Select Level" itemValue="" />
        <f:selectItems value="#{examSubjectMB.level}" var="level"
        itemValue="#{level.levelId}" itemLabel="#{level.name}" />
    <p:ajax listener="#{seatPlanGenerationMB.loadLevelwise()}" process="cmbLevel"   update="tblStudents :messageGrowl" />
        </p:selectOneMenu>
</h:panelGrid>

0 个答案:

没有答案