3 Replies Latest reply on Apr 7, 2010 6:34 PM by nbelaevski

    rich:dataGrid

      I have a one to many relationship between table A->B, A->C, and  A->D. More specifically the entities are A-CourseOffering, B-FCE,  C-FCE_INS and D-FCE_TA.   Now I am trying to display data from FCE,  FCE_INS, and FCE_TA.  So consider the primary key for A is, course_No,  semester, section and SEQ_NO.  So for each combination of these values  there are many records in each of the tables mentioned.

       


      Now  when I am displaying this info, I am using rich:dataGrid to iterate  through the list and display it, since I have static text questionnaire  for each of the columns of the tables(FCE, FCE_INS, FCE_TA).  So for  example, other than the primary key, if FCE has 7 columns, then there  are 7 questions and each question will have a radiobutton selected for  the answer in that respective column.  Hopefully this clears how I am  trying to display the page.

       


      The point is I need to iterate  simultaneously through the three arraylists, FCE, FCEINS, and FCETA and  display according to the sequence no on each page.

       

      I use the  rich:dataGrid to iterate through the lists.  I use a rich:dataScroller  for paging.  The problem is that I am able to iterate through the first  list FCE, and the first row data appears on the first page, the second  row on the second page, and so on and so forth.

       

      But right below  that if I am trying to display the first row data of FCE_INS and FCE_TA  on the first page, and second row data on the second page, it is not  coming.

       

      HOW DO WE ITERATE SIMULTANEOUSLY THROUGH THREE LISTS  AND DISPLAY FIRST ROW DATA IN THE FIRST PAGE, and SECOND ROW DATA ON THE  SECOND PAGE.

       


      Please do let me know.

       

      thanks
      Sai

        • 1. Re: rich:dataGrid
          nbelaevski

          Hi Sai,

           

          Can you please clarify more on the problem? Page code, UI sketches/screenshots would be very helpful.

          • 2. Re: rich:dataGrid

             

             

            Hi Nick

             

            Please find the code below.

             

            <

             

            rich:dataGrid value="#{courseSearch.selCourseFceList}" var="fce" elements="1" >

             

             

             

             

            <f:facet name="header">

             

             

             

             

             

            <rich:datascroller > </rich:datascroller>

             

             

             

             

             

            </f:facet>

             

             

             

             

             

             

             

             

            <h:commandLink action="#{courseSearch.loadUpdFacultyCourseEval()}" value="Edit FCE"

            style="font-size: 1em;" >

             

            <f:setPropertyActionListener value="#{fce}"

            target="#{courseSearch.selectedFce}" />

             

             

             

             

             

            </h:commandLink>

             

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputText escape="true" style="float:right;font-weight:bold;" value="Sequence No: #{fce.id.sequenceNo} of  #{courseSearch.selCourseFceList.size()}" />

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="1. To  what extent does the course content match the stated goals, objectives and  requirements? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.objective}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="2. How  well do the exams and quizzes cover the material presented in the class and in  the assigned readings? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.exams}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="3. How  well do the assignments cover the material presented in the class?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.assignments}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="4. How  well do the lectures and readings contribute to your learning in this course?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.lectures}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="5. How  well do the discussions and special review sessions contribute to your learning  in this course? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.discussions}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="6. How  relevant is this course to the curriculum? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.relevancy}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="7. In  general how do you rate this course? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fce.overallRating}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

            <rich:separator />

             

             

             

             

             

            <a4j:outputPanel rendered="#{courseSearch.facultyNames.size>0}" >

             

             

             

             

            <rich:dataGrid value="#{courseSearch.facultyNames}" var="facName" >

             

             

             

             

            <s:div>

             

             

             

             

             

            <h:outputText escape="true" style="float:left;font-weight:bold;" value="INSTRUCTOR:  #{facName.toString()}" />

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <rich:dataGrid value="#{courseSearch.selCourseFceInsList}" var="fceIns" >

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="1. How  enthusiastically does the instructor convey his or her knowledge of the subject  matter? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceIns.enthusiasm}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="2. How  well does the instructor answer questions and provide feedback on your  performance? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceIns.answerNFeedback}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="3. To  what extent does the instructor demand critical or original thinking?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceIns.criticalThinking}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="4.  Overall how do you rate this instructor? " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceIns.overallRating}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

            </rich:dataGrid>

             

             

             

             

            </rich:dataGrid>

             

             

             

             

            </a4j:outputPanel>

             

             

             

             

             

            <rich:separator />

             

             

             

             

             

            <a4j:outputPanel rendered="#{courseSearch.taNames.size>0}">

             

             

             

             

            <rich:dataGrid value="#{courseSearch.taNames}" var="taName" >

             

             

             

             

            <s:div>

             

             

             

             

             

            <h:outputText escape="true" style="float:left;font-weight:bold;" value="TEACHING ASSISTANT:  #{taName.toString()}" />

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <rich:dataGrid value="#{courseSearch.selCourseFceTaList}" var="fceTa" >

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="1. How  would you rate the TA's enthusiasm and knowledge of the subject matter?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceTa.enthusiasm}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="2. Does  the TA communiate information and ideas clearly and in a well-organized way?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceTa.communication}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="3. How  much patience or rapport does the TA have with you in answering questions about  problems"/>

             

             

             

             

            <h:outputLabel escape="false" style="font-weight:bold;" value="&amp;nbsp;&amp;nbsp;&amp;nbsp;you do not understand?  " /><br/><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceTa.patience}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="4. Is  the TA generally available during designated appointment times?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceTa.availablity}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

             

            <s:div>

             

             

             

             

            <h:outputLabel escape="true" style="font-weight:bold;" value="5. In  general, how do you rate this person's abilities as a Teaching Assistant?  " /><br/>

             

             

             

             

             

            <h:selectOneRadio style="float:right;"

            value="#{fceTa.overallRating}">

             

             

             

             

             

             

            <f:selectItem itemLabel="1" itemValue="1"/>

             

             

             

             

            <f:selectItem itemLabel="2" itemValue="2"/>

             

             

             

             

            <f:selectItem itemLabel="3" itemValue="3"/>

             

             

             

             

            <f:selectItem itemLabel="4" itemValue="4"/>

             

             

             

             

            <f:selectItem itemLabel="5" itemValue="5"/>

             

             

             

             

            <f:selectItem itemLabel="N/A" itemValue="0"/>

             

             

             

             

            </h:selectOneRadio>

             

             

             

             

             

            </s:div><br/><br/>

             

             

             

             

            </rich:dataGrid>

             

             

             

             

            </rich:dataGrid>

             

             

             

             

            </a4j:outputPanel>

             

             

             

             

             

             

             

             

            <f:facet name="footer">

             

             

             

             

             

            <rich:datascroller> </rich:datascroller>

             

             

             

             

             

            </f:facet>

            </rich:dataGrid>

             

             

            There are three lists selCourseFceList, selCourseFceInsList and selCourseFceTaList.  courseSearch is the backing bean which references the entity CourseOffering.  CourseOffering has one to many relationship b/w itself and FCE, FCE_INS, and FCE_TA.  Thus there are three lists pertaining to the relationship.

             

            I need to be able to iterate through each of the lists display first row of the list on the first page, second row on the second page, so on and so forth.  Hence I made use of rich:dataScroller for paging.  I am able to display the first list contents (selCourseFceList) in the manner specified.  So if you click on the 5 on the dataScroller you are seeing the 5th row contents of the FCE table.  But it is with FCE_INS and FCE_TA that it is a problem.  I am noticing the same row contents getting repeated in all pages.

             

            Do let me know if any other information is required.

             

             

            Thanks again for your quick response.

             

            Sai

            • 3. Re: rich:dataGrid
              nbelaevski

              I'd suggest to remodel your bean classes as a single list of helper object having three attributes standing for FCE, FCE_INS, and FCE_TA.

              But the question is: do all the lists have the same size? If no, how should UI display missing items that exist only in one list, but absent in another?