4 Replies Latest reply on Aug 30, 2013 6:46 AM by _user

    Master Details Relation issue

    _user

      Hi

       

      I have page with tabs.when i click on tab u have to show the table depends on the tab click.

       

      It is like dept names as a tabs and when i click on dept name i have to show all the employees under department as table in the tab.

      Problem: I m seeing all the employees in the single tab itself.

       

      But here I have taken  EmployeeVO for displaying a table  as a transient VO. I am populating data for this VO from another VO.

      I have created View link between DeptVO and EmpTRVO.

      Problem here after running my page I could see all the employees in the tabs. it s not based on dept name.

      I am thinking that i have not populated date corectly.

      Here is the population code:

       

      here is the code :

       

      ****************************

          public void populateData(Number id){

              DeptVOImpl deptVO= this.getDeptVO2();

              RowSetIterator diter = deptVO.createRowSetIterator("dept");

             

              this.getEmpTRVO2().executeQuery();

              this.getEmpTRVO2().executeEmptyRowSet();

              this.getEmpTRVO2().clearCache();

             

              while (diter.hasNext()) {

                  DeptVORowImpl deptRow =

                      (DeptVORowImpl)diter.next();

                  if(deptRow !=null){

                       Number deptId = deptRow.getDepartmentId();

                       //Get employees for the dept

                       EmoVOImpl v = this.getEmoVO1();

                       v.setWhereClause("department_id="+deptId);

                       v.executeQuery();

                      

                       RowIterator trVO = deptRow.getEmpTRVO();

                       

                       RowSetIterator eiter = v.createRowSetIterator("emp");

                       while(eiter.hasNext()){

                           EmoVORowImpl erow = (EmoVORowImpl)eiter.next();

                           EmpTRVORowImpl trrow = (EmpTRVORowImpl)trVO.createRow();

                           trrow.setdeptId(deptId);

                           trrow.setempId(erow.getEmployeeId());

                           trrow.setempName(erow.getFirstName());

                        //   trrow.setDeptVO(deptRow);

                           trVO.insertRow(trrow);

                          

                       }

                       eiter.closeRowSetIterator();

                  }

              }

              diter.closeRowSetIterator();

                 

          }

      *********************************************

      Jspx:

       

      <af:panelTabbed id="pt1">

                  <af:iterator id="i1" value="#{bindings.DeptVO2.collectionModel}" var="row1" varStatus="indx" >

                    <af:showDetailItem text="#{row1.bindings.DepartmentId.inputValue}" id="sdi1">

                      <af:table value="#{row1.EmpTRVO.collectionModel}" var="row"

                                rows="#{bindings.EmpTRVO2.rangeSize}"

                                emptyText="#{bindings.EmpTRVO2.viewable ? 'No data to display.' : 'Access Denied.'}"

                                fetchSize="#{bindings.EmpTRVO2.rangeSize}"

                                rowBandingInterval="0" id="t1">

                        <af:column sortProperty="empId" sortable="false"

                                   headerText="#{bindings.EmpTRVO2.hints.empId.label}"

                                   id="c2">

                          <af:inputText value="#{row.bindings.empId.inputValue}"

                                        label="#{bindings.EmpTRVO2.hints.empId.label}"

                                        required="#{bindings.EmpTRVO2.hints.empId.mandatory}"

                                        columns="#{bindings.EmpTRVO2.hints.empId.displayWidth}"

                                        maximumLength="#{bindings.EmpTRVO2.hints.empId.precision}"

                                        shortDesc="#{bindings.EmpTRVO2.hints.empId.tooltip}"

                                        id="it1">

                            <f:validator binding="#{row.bindings.empId.validator}"/>

                            <af:convertNumber groupingUsed="false"

                                              pattern="#{bindings.EmpTRVO2.hints.empId.format}"/>

                          </af:inputText>

                        </af:column>

                        <af:column sortProperty="deptId" sortable="false"

                                   headerText="#{bindings.EmpTRVO2.hints.deptId.label}"

                                   id="c3">

                          <af:inputText value="#{row.bindings.deptId.inputValue}"

                                        label="#{bindings.EmpTRVO2.hints.deptId.label}"

                                        required="#{bindings.EmpTRVO2.hints.deptId.mandatory}"

                                        columns="#{bindings.EmpTRVO2.hints.deptId.displayWidth}"

                                        maximumLength="#{bindings.EmpTRVO2.hints.deptId.precision}"

                                        shortDesc="#{bindings.EmpTRVO2.hints.deptId.tooltip}"

                                        id="it3">

                            <f:validator binding="#{row.bindings.deptId.validator}"/>

                            <af:convertNumber groupingUsed="false"

                                              pattern="#{bindings.EmpTRVO2.hints.deptId.format}"/>

                          </af:inputText>

                        </af:column>

                        <af:column sortProperty="empName" sortable="false"

                                   headerText="#{bindings.EmpTRVO2.hints.empName.label}"

                                   id="c1">

                        

                      </af:table>

                  

                             

                    </af:showDetailItem>

                  </af:iterator>

                </af:panelTabbed>

        • 2. Re: Master Details Relation issue
          _user

          Hi Frank,

          thanks for the reply.

           

          but here i m creating programmatic Vo for displaying child table data. So on the page load itself it is showing all the emp records data in the first tab.when i clik on 2nd tab onwards it is showing 'no records'.

          what i am thinking is i m not able to properly populated data.here is my populaton code.

           

          ***************************

              public void populateData(Number id){

                  DeptVOImpl deptVO= this.getDeptVO2();

                  RowSetIterator diter = deptVO.createRowSetIterator("dept");

                

                  this.getEmpTRVO2().executeQuery();

                  this.getEmpTRVO2().executeEmptyRowSet();

                  this.getEmpTRVO2().clearCache();

                

                  while (diter.hasNext()) {

                      DeptVORowImpl deptRow =

                          (DeptVORowImpl)diter.next();

                      if(deptRow !=null){

                           Number deptId = deptRow.getDepartmentId();

                           //Get employees for the dept

                           EmoVOImpl v = this.getEmoVO1();

                           v.setWhereClause("department_id="+deptId);

                           v.executeQuery();

                         

                           RowIterator trVO = deptRow.getEmpTRVO();

                          

                           RowSetIterator eiter = v.createRowSetIterator("emp");

                           while(eiter.hasNext()){

                               EmoVORowImpl erow = (EmoVORowImpl)eiter.next();

                               EmpTRVORowImpl trrow = (EmpTRVORowImpl)trVO.createRow();

                               trrow.setdeptId(deptId);

                               trrow.setempId(erow.getEmployeeId());

                               trrow.setempName(erow.getFirstName());

                            //   trrow.setDeptVO(deptRow);

                               trVO.insertRow(trrow);

                             

                           }

                           eiter.closeRowSetIterator();

                      }

                  }

                  diter.closeRowSetIterator();

                    

              }

          • 3. Re: Master Details Relation issue
            _user

            pls reply..

            • 4. Re: Master Details Relation issue
              _user

              Any update pls