Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with dynamic table

974835Jun 26 2013 — edited Jun 30 2013

Hi,

I'm using jdevloper 11.1.2.3.0

I have a requirement to create a popup with read only table, the user will be able to filter and select one row in the table.

The issue is that this table should be dynamic.

means that sometime it should display data from departments table and other time from employees table.

I was trying to do that according to shay  https://www.youtube.com/watch?v=TwIKt7e4vEw

1. I created a view "DynView" with "select * from dual" query and with no attributes (I removed the "Dummy" attribute, because I get an error about it).

2. In the appModule I created this method:

  public void makeVO(String sql){

        ViewObject vo = this.findViewObject("DynView");

        vo.remove();

        vo = this.createViewObjectFromQueryStmt("DynView", sql);

        vo.executeQuery();

    }

3. Then I dragged the "DynView" from the data controls, In the list that I got I didn't find an option of "ADF dynamic table" only "ADF read-only dynamic table"

      although I imported the ADF Dynamic Components to my project.

      as I saw in this link https://forums.oracle.com/message/9778442#9778442 it's because I'm using Facelets.


       so this is my code:

<af:table rows="#{bindings.DynView.rangeSize}" fetchSize="#{bindings.DynView.rangeSize}"

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

                  var="row" rowBandingInterval="0" value="#{bindings.DynView.collectionModel}"

                   selectedRowKeys="#{bindings.DynView.collectionModel.selectedRow}"

                   selectionListener="#{bindings.DynView.collectionModel.makeCurrent}"

                  rowSelection="single" id="t1">

             <af:forEach items="#{bindings.DynView.attributeDefs}" var="def">

                   <af:column headerText="#{bindings.DynView.labels[def.name]}" sortable="true"

                                           sortProperty="#{def.name}" id="c1">

                       <af:outputText value="#{row[def.name]}" id="ot2"/>

                 </af:column>

             </af:forEach>

</af:table>

4. in the backing bean, on popupFetch I'm doing this:

public void onPopupFetch(PopupFetchEvent popupFetchEvent) {

        OperationBinding operationBinding = getBindings().getOperationBinding("makeVO");

        operationBinding.getParamsMap().put("sql", "select department_id, department_name  from department");

        Object result = operationBinding.execute();   

    }

The results of all of this is, the popup is opened with correct columns header and one empty row but no data.

also I would like to know if there is a way to add filter fields for dynamic table.

Any idea?

what am I missing here?

Thanks!!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2013
Added on Jun 26 2013
4 comments
677 views