How to create multiple new rows in ADF Table?

Hello,
being new to ADF Faces/BC I managed to display data in an ADF Table and create new entries using the "CreateInsert" operation (one at a time).
Now, the next task is to create multiple new rows at the same time, set some default values and display the new rows in the ADF table. Then the user will enter additional data and commit the new rows.
Where do I step in? In the EntitiyImpl? Can this be handled declaratively or do I have to implement custom method(s) in the AM?
Thanks
Gerald

Hi John,
I'm still getting the following error
Error(94,144): method getValue() not found in class javax.faces.el.ValueBinding
What should it be casted to?
The code in backing bean is like this..
package view.backing;
//import com.test.model.TestAppModuleImpl;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
//import javax.faces.event.FacesListener;
//import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.faces.component.core.data.CoreColumn;
import oracle.adf.view.faces.component.core.data.CoreTable;
import oracle.adf.view.faces.component.core.input.CoreInputText;
import oracle.adf.view.faces.component.core.nav.CoreCommandButton;
import oracle.adf.view.faces.component.core.output.CoreMessages;
import oracle.adf.view.faces.component.html.HtmlBody;
import oracle.adf.view.faces.component.html.HtmlHead;
import oracle.adf.view.faces.component.html.HtmlHtml;
import oracle.jbo.ApplicationModule;
import oracle.jbo.Row;
import oracle.jbo.ViewObject;
//import oracle.jbo.server.ViewObjectImpl;
//import view.utils.EL;
public class MultipleInsert1 {
private HtmlHtml html1;
private HtmlHead head1;
private HtmlBody body1;
private CoreMessages messages1;
private HtmlForm form1;
private CoreTable table1;
private CoreColumn column1;
private CoreInputText inputText1;
private CoreColumn column2;
private CoreInputText inputText2;
private CoreCommandButton commandButton1;
private HtmlPanelGroup panelGroup1;
private CoreCommandButton commandButton2;
public void setHtml1(HtmlHtml html1) {
this.html1 = html1;
public void createMultiRows(ActionEvent actionEvent) {
DCBindingContainer dc = (DCBindingContainer) FacesContext.getCurrentInstance().getApplication().createValueBinding("#{bindings}").getValue();
DCIteratorBinding iter = dc.findIteratorBinding("TestView1Iterator");
ViewObject vo = iter.getViewObject();
for (int i=1; i<=5; i++) {
Row newRow = vo.createRow();
newRow.setAttribute("Id", i);
ApplicationModule am = vo.getApplicationModule();
am.getTransaction().commit();
vo.executeQuery();
Do I need to import something else?
Thanks,
Shri.

Similar Messages

  • How to create a new row for a VO based on values from another VO?

    Hi, experts.
    in jdev 11.1.2.3,
    How to create a new row for VO1 based on values from another VO2 in the same page?
    and in my use case it's preferable to do this from the UI rather than from business logic layer(EO).
    Also I have read Frank Nimphius' following blog,but in his example the source VO and the destination VO are the same.
    How-to declaratively create new table rows based on existing row content (20-NOV-2008)
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    I have tried:
    1.VO1(id,amount,remark1) and VO2(id,amount,remark2) are based on different EO,but render in same page,
    2.Drag and drop a Createwithparams button for VO1(id,amount,remark),
    3.add: Create insertinside Createwithparams->Nameddata(amount),
    4.set NDName:amount, NDValue:#{bindings.VO2.children.Amount}, NDtype:oracle.jbo.domain.Number.
    On running,when press button Createwithparams, cannot create a new row for VO1, and get error msg:
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: For input string: "Amount"
    java.lang.NumberFormatException: For input string: "Amount"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    Can anyone give some suggestions?
    Thanks in advance.
    bao
    Edited by: user6715237 on 2013-4-19 下午9:29

    Hi,CM,
    I'm really very appreciated for your quick reply! You know, today is Saturday, it's not a day for everyone at work.
    My principal requirement is as follows:
    1.select/check some rows from VO2, and for each selection create a new row with some attributes from VO2 as default values for VO1's corresponding attributes, and during this process the user may be cancel/uncheck or redo some of the selections.
    --so it's better to implement it in UI rather than in EO.
    2.it's better to implement this function with declarative way as in Frank Nimphius' blog.
    --little Jave/JS coding, the better. I only have experience in ORACLE FORMS, little experience in JAVA/JS.
    In order to get full information for the requirements of my use case, can take a check at:
    How to set default value for a VO query bind variable in a jspx page?
    (the end half of the thread: I have a more realworld requirement similar to the above requirement is:
    Manage bank transactions for clients. and give invoices to clients according to their transaction records. One invoice can contain one or many transactions records. and one transaction records can be split into many invoices.
    Regards
    bao
    Edited by: user6715237 on 2013-4-19 下午11:18
    JAVE->JAVA

  • Focusing a field/column in the new row of adf table

    Hi all,
         I am using JDeveloper 11.1.2.4.0. and UI-Shell Template in Main application and sub applications are added to this master application as ADF library jar files. Application is working fine.
    I am trying to focus to make focus on a column in the newly created row in one of the sub application by referring the below link
    http://adfnbpel.wordpress.com/2013/08/14/focusing-a-fieldcolumn-in-the-new-row-of-adf-table/
    I created a single application and found that its working
    But in my application focus is not working.
    When i checked the java script by using FireBug console it is found that comp = AdfPage.PAGE.findComponent(‘”+inputId+”‘); is getting as "undefined" , where inputId = table.getClientId(facesCtx) + “:” + rowId + “:” + “it3″; I am getting the exact row id also. When i tried with by passing the table id as input id like inputId = table.getClientId(facesCtx) ; the fire bug console then showing the table id. So its sound strange.
    What may be the cause of not able to find the input text it3 by using findComponent ?
    Is any body can suggest a solution for this.
    Thanks in advance,
    Gijith

    Hi,
    read up about "findComponentByAbsoluteLocator" in http://www.oracle.com/technetwork/developer-tools/jdev/1-2011-javascript-302460.pdf
    or check ...
    AdfPage JS doc
    Frank

  • How to add new row to adf table progrmatically

    Hi,
    I have a bean with a list and correspoding getter & setter methods inside it.
    I created a datacontrol out of the bean and I am displaying af:table in the ui
    binded to this list.
    Ex:
    public class StudentBean {
    private List<Student> students;
    // getter & setter methods.
    jsp
    <af:table value="#{bindings.students.collectionModel}" var="row"
    rows="#{bindings.students.rangeSize}"
    emptyText="#{bindings.students.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.students.rangeSize}"
    rowBandingInterval="0"/>
    How to add a new row programitically to this adf table.
    I dragged and dropped 'Create' from operations menu on to jsp.
    But on click of that.no new row is being added to the current table.
    On click of a button in u.i I want to add a new row to the table.
    Thanks,
    Praveen

    Hi,
    The source code is as below.
    <af:table value="#{bindings.students.collectionModel}" var="row"
    rows="#{bindings.students.rangeSize}"
    emptyText="#{bindings.students.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.students.rangeSize}"
    rowBandingInterval="0"
    filterModel="#{bindings.rscGroupsQuery.queryDescriptor}"
    queryListener="#{bindings.rscGroupsQuery.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.rscGroups.collectionModel.selectedRow}"
    selectionListener="#{bindings.rscGroups.collectionModel.makeCurrent}"
    rowSelection="single" id="t1"/>
    <af:commandButton actionListener="#{bindings.Create.execute}"
    text="Create" disabled="#{!bindings.Create.enabled}"
    id="cb1" partialTriggers="t1"/>
    Please let me know where am I doing wrong?
    On click of this button,it is not adding a row dynamically.
    Thanks,
    Praveen

  • How to ADD new Row In ADF Table?

    Hello!
    I need to insert a row in table when clicking on the "New", can someone help me? Citing some examples? I'm lost.
    My table is called tableArchive, and I need to add a line on it.
    This table is a list called listArchive, which is associated to this table.

    On the button drag drop createInsert operation from DataContol .
    go to data control->open your table VO-> open operatin inside that.-> drag drop the createInsert.Put id of button into partial trigger of table.make button autosubmit to true.
    see this
    Creating a New Row Using an ADF Iterator Binding
    Unwinding ADF: How to add a new row at the end of the ADF Table

  • How to create the new row with existing values

    Hi all,
    first of all i create a row,
    i opened that in edit mode,
    suppose i want to edit any one of the value in that recordd,
    that time compulsory create a new row with those valuess.
    how can i create a new row with those valuess.

    Hi Anusha,
    This code correct for your requirement, only thing is you are not able to modify it as per your requirement.
    What you have to do is:
    1. Copy queried row into into new row, change primary key values(but don't commit your changes here).
    2. Now you have two rows in your VO(OLD as well as New)
    3. Make any changes if you want using User Interface.
    4. At the save button first compare OLD and NEW row, if any value is differing then commit the chnages(it will insert new row in corresponding database table), if no changes are there I mean to say OLD value and NEW rows are same then rollback(it will remove copied row from VO and no row will be inserted in database.)
    While comparing rows please note that Primary keys will not be same so don't compare Primary keys while comparing rows.
    I hope it will help you.
    Regards,
    Reetesh Sharma

  • How can I insert one row in ADF Table in JDeveloper 10.1.3

    Hi all,
    How can I add new row ADF Table in JDeveloper 10.1.3
    NOTE : I tried using create button still not working
    thanks

    If you are using ADF BC - try replacing the binding of the operation from Create to CreateInsert.
    See Re: A simple JSF Table CRUD - How To

  • How to insert a new Row in a table? - Need help

    Hi everyone,
    I'm using JDeveloper 10.1.2, UIX pages and STRUTS.
    This is my situation: When I navigate from page one to page two, I have in my page2 one table and I need to create a new row with some values by default, but I don't want to commit this line except the user decides to complete this line.
    Can anyone help me? This is very important.
    Thanks,
    Atena

    Hi Sascha,
    thanks very much for your replay.
    My project changed and I have another question about this. My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml like this in page2 (S2PopUpObstaculos):
    <action path="/S2PopUpObstaculos" type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can you help me?
    Thanks,
    Atena

  • Can we create a new row in a table using a down arrow

    Hi,
    I am using jdeveloper 11.1.1.6.
    For one of my project, I have a requirement where i need to create a new row in table using a down arrow. My client does not want to use mouse clicks. They want to use keyboard as much as possible.(Fast data entry).
    Is it possible to create a new row using down arrow. Any pointers will be helpful!
    Thanks,
    Umesh

    you can try this thing
    steps
    - capture downkey event - may b this help http://www.qualitycodes.com/tip/1/capturing-keys-with-javascript.html
    if not google more
    -then call from javascript call java method - https://blogs.oracle.com/jdevotnharvest/entry/how-to_call_server_side_java_from_javascript
    -then create new row of table VO .....

  • Create a new row in a table without using add new row button

    I want to add a new row to the table without using the add new row button of the table. I'm not able to display default row in the table. Though if click on apply the record appears after saving in the database. Any thoughts how to implement this functionality.

    Here is what you have to do.
    1) You have to handle this in processRequest()
    2) In the AM code , u need to check if there is already a row exisit or vo is blank
    if (vo.getFetchedRowCount() == 0)
    // first time
    vo.setMaxFetchSize(0); // THIS IS REQUIRED.
    Row row = vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    else
    //If already rows are there then you suppose to insert in the end
    // i assume you would have execute your vo
    YourVORowImpl row= (YourVORowImpl)vo.getRowAtRangeIndex(0);
    vo2.insertRowAtRangeIndex();
    It should work.

  • EJB 3.0 - Custom create method - current row in adf table

    Hello,
    its funny I cannot find a good solution for such simple problem.
    I'm using EJB 3.0 stateles session bean, ADF controller and ADF Faces.
    I have simple page with read-only adf table containing roles and Create Role button. The button sends you to create page. This works.
    I wrote my own create role method in session bean.
    When I use this method instead of standard create then the new role row is no longer current in adf table. So create page displays different row not the new one.
    How to make my new role row current in the adf table?
    Rado

    Thank you Frank,
    yes this seems to be the only solution I can use.
    In fact the role table is detail table. This is why I have my own constructor with one parameter: master entity. So the "create page" you suggested have to have access to master entity and this is why I wanted to create new role instance on fist page - there is master entity accessible.
    Now I need to send master instance to create_page somehow.
    What you think is the best way? Are bindings from previous page accessible directly or I have to use request/session/process scope?
    Another solution would be to have method "createAnotherDetail" in master entity. But I'm afraid I will have again problem with currency.
    Rado

  • ADF 11g How to create the custom FilterableQueryDescriptor for adf table

    Can you please let me know on the following.
    1. I am dispalying the adf table using a List from the managed bean
    2. I wanted to filter the table using the filter model.
    3. i wanted to create the sub class of FilterableQueryDescriptor which i can specify. Not finding enough information on how to create and add the information in the setFilterCriteria
    Can you please provide some insight into this topci

    Hello there
    I have the same issue: chaging the background color of some column headers.
    My application is using a custom skinning and when i had headerClass property with a custom class defined in a separate css file, the page generated specified first the class from the skinning and then my new class definition. But my skinning is specifying a background color so the color is not overriden. Any idea?
    ADF code:
    <link type="text/css" rel="stylesheet" href="../../css/pivot.css" id="myStyles"/>
    <af:column headerText="#{level1.userObject.name}"
    headerClass="inputHeader"
    sortable="false" align="center" width="100"
    id="col_level1" >
    Generate HTML code:
    <th align="center" class="xuh inputHeader" afrroot="true" rowspan="2" afrleaf="true" dindex="6" id="pt1:tableId:col_level1" style="">
    <div class="x13t">AEKLF</div>
    </th>
    My CSS file:
    .inputHeader{
    background-color: Red;
    background-image: none;
    color: Black;
    font-weight: bold;
    Thanks for your help !

  • How to display multiple selected rows in a table inside a popup?

    Hi,
    I have a table on which multiple selection is enabled. I am able to get hold of multiple selected rows i.e. i am able to iterate over the selected row keys and print their values. Now, my problem is how to display the contents of all the selected rows in a popup? I get the details of only one row when I launch the popup.
    Thanks
    Karan

    Hi,
    Not confident if this works or not but just try it...
    1. create a ViewLink between the same view Object.
    The source and destination wil be the same Vo and the source and destination attribute will be the pk of both Vos.
    2. Update the changes in Appln Module.
    Open the AM and in DataModel tab .
    select the Same VO from which you created table in the DataModel Listbox and select the VL in the "Avaible View Objects" List Box. Add under it(selected vo in datamodel listbox).
    3. Refresh DataControl accordion.
    4. in your jsff page drag and drop the child vo as a table..
    See if it works
    Regards,
    Santosh.

  • How to delete a selected row from adf table

    Hi
    I am using a ADF Table to get data from the database, i need to select a specific row and then delete it how to get
    this done.
    Thanks in Advance.

    Or try this code:
    In your backing bean:
        public void deleteRows(ActionEvent actionEvent) {
            ((AppModuleImpl)getApplicationModuleForDataControl()).deleteRowEmp();
        public static Object resolveExpression(String expression)
                try
                    FacesContext facesContext = FacesContext.getCurrentInstance();
                    Application app = facesContext.getApplication();
                    ExpressionFactory elFactory = app.getExpressionFactory();
                    ELContext elContext = facesContext.getELContext();
                    ValueExpression valueExp =
                        elFactory.createValueExpression(elContext, expression, Object.class);
                    return valueExp.getValue(elContext);
                catch (Exception e)
                   ;// log you message here
                return null;
             * Get application module for an application module data control by name.
             * @param name application module data control name
             * @return ApplicationModule
            public static ApplicationModule getApplicationModuleForDataControl()
                return (ApplicationModule) resolveExpression("#{data.AppModuleDataControl.dataProvider}");
            }In your AppmoduleImpl:
        public void deleteRowEmp(){
            this.getEmpView1().removeCurrentRow();
            this.getDBTransaction().commit();
        }And another option is to expose the appmodule method as a client and bind to the jspx as a button.

  • How to limit no of rows in ADF table

    Hi all,
    i want to limit the number of rows displayed in ADf table. I tried using range size, but it didn't work. In the post
    Limiting ADF table number of rows is not working
    it was stated that it is a bug. Is it fixed now or is there any work around to fix this.
    Thanks in advance,
    Nad

    Hi Nad..
    Hope this would help you..
    Suppose you have these..
    Jspx Page - RangeTable.jspx
    Backing Class - RangeTable.java
    Iterator used to load Table in page definition - ViewObjTableData
    First of all In your pagedefinition page change the RangeSize value to -1 to display all rows in your table like
    <iterator id="ViewObjTableDataIterator" RangeSize="-1"
                  Binds="ViewObjTableData" DataControl="AppModuleDataControl"/>Now Goto your Backing bean and there put the setter getter method to limit your Table to show data as you want.. Like..
    public static int rangeSize = 10;   
        public void setRangeSize(int rangeSize) {
            this.rangeSize = rangeSize;
            AdfFacesContext.getCurrentInstance().addPartialTarget(table1);
        public int getRangeSize() {
            return rangeSize;
        }Line having this is your default no of rows which you will get on table load..
    public static int rangeSize = 10;and
    this will forcely refresh your table according to your choise
    AdfFacesContext.getCurrentInstance().addPartialTarget(table1);Now come to Your Jspx page and
    Add af:selectOneChoice to Action facet of your table and add some selectItem having value of *10*,*20*, and *30* According to your choise
    <af:selectOneChoice label="Row Limit" autoSubmit="true"
                                          binding="#{backing_RangeTable.selectOneChoice1}"
                                          id="selectOneChoice1"
                                          value="#{backing_RangeTable.rangeSize}">
               <af:selectItem label="10" value="10"
                                       binding="#{backing_RangeTable.selectItem1}"
                                       id="selectItem1"/>
               <af:selectItem label="20" value="20"
                                       binding="#{backing_RangeTable.selectItem2}"
                                       id="selectItem2"/>
               <af:selectItem label="30" value="30"
                                       binding="#{backing_RangeTable.selectItem3}"
                                       id="selectItem3"/>
    </af:selectOneChoice>set its autoSubmit property to true and bind the value property to the rangeSize of your backing beans
    now in your table change binding property of Rows to your backingbean's rangeSize like
    rows="#{backing_RangeTable.rangeSize}"and also set this
    partialTriggers="selectOneChoice1"That all dear..
    Now check it out and let me know that you got your solution or not?
    and if you got your right answer then dont forget to put \[SOLVED\] tag with your subject line. and mark this answer as correct and helpful.. :-)
    Thanks,
    Fizzz...

Maybe you are looking for