Problem with deleting a new row in table

Hi
I'm using JDev 11.1.1.2.0
Please someone tell me if he/she experience the same issue:
- I have an simple entity with PrimaryKey other than RowID. I have a ViewObject on top of the Entity.
- From this view I create Editable table and add createInsert and Delete buttons.
This is one of the most common scenarios.
Now when I click createInsert a new blank row is added to the table. I enter it's primary key (because is mandatory) and move selection to some other row (let say X).
When I go back and select my new Row and press Delete -> it is not deleted but the row X is deleted.
This is because the table is not refreshed and it cant select the new row.
How can I deal with this problem?
Thanks
Angel

I tried with adding my selectionListener method like this:
        Object next = selectionEvent.getAddedSet().iterator().next();
        Object prev = selectionEvent.getRemovedSet().iterator().next();
        System.out.println(prev + " " + next);      
        DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iter = (DCIteratorBinding)bc.get("TestDopSyotvIterator");
        FacesCtrlHierBinding object1 = (FacesCtrlHierBinding)bc.get("TestDopSyotv");
        FacesCtrlHierBinding.FacesModel collectionModel = (FacesCtrlHierBinding.FacesModel)object1.getCollectionModel();
        collectionModel.makeCurrent(selectionEvent);I add new row, enter data and change selection. Then the system.out prints the right keys of the rows.
But when I go back to the new added row, the system.out prints "null" for the "next" value (that means the rowKey was lost).
Any ideas how to fix this?

Similar Messages

  • Problems with adding a new row in my table

    Im an ADF beginner but I thought it would be simple to to do some basic CRUD stuff in ADF. Im now even struggling when i try to add a new row to my table.
    Seems that the primary key id is not set correctly...
    could someone help?

    Hi,
    Have a look to this page CREATE SEQUENCE
    Regards,
    Sébastien
    Creating a Sequence: Example
    The following statement creates the sequence customers_seq in the sample schema oe. This sequence could be used to provide customer ID numbers when rows are added to the customers table.
    CREATE SEQUENCE customers_seq START WITH     1000 INCREMENT BY   1 NOCACHE NOCYCLE;

  • Problem with adding a new row in JTable

    Hi,
    I've created a JTable using DefaultTableModel with DefaultTableModel(Object[][] obj,Object[] col) constructor.I've written actionListener for a JButton which should add new row to the tablemodel.Now, the listener adds the row to the model.But its throwing an ArrayOutofBoundsException and the added row is not visible unless I click on any column of the table.
    Kindly help me to resolve this problem
    TIA
    Regards
    Gopi

    Thanks a lot for the reply. Here is the complete code
    TableImpl.java
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    import java.util.Vector;
    public class TableImpl extends JFrame {
    DefaultTableModel dataModel;     // TableModel Variable
    /* Constructor to add table and button to the frame     */
    TableImpl() {
              getContentPane().setLayout(null);
              setSize(800,600);
              myModel();
              final JTable table = new JTable(dataModel);
              JScrollPane scrollpane = new JScrollPane(table);
              getContentPane().add(scrollpane);
              scrollpane.setBounds(10,10,700,300);
              TableColumn tcCol = table.getColumnModel().getColumn(1);
              /* Adding ComboBox to the CellEditor of Column 2 of table     */
              JComboBox jcbComboBox = new JComboBox();
              final ReturnVector vctDBAccess = new ReturnVector();
              jcbComboBox.addItem(vctDBAccess.vctGetOidList().elementAt(0).toString());
              jcbComboBox.addItem(vctDBAccess.vctGetOidList().elementAt(2).toString());
              jcbComboBox.addItem(vctDBAccess.vctGetOidList().elementAt(4).toString());
              tcCol.setCellEditor(new DefaultCellEditor(jcbComboBox));
              /*     Adding Listener for Table      */
              dataModel.addTableModelListener(new TableModelListener() {
                   public void tableChanged(TableModelEvent e) {
              /* Columns Manipulation */
                        if(dataModel.getColumnName(e.getColumn()).equals("Second")) {
                        int iRow = e.getFirstRow();
                        int iColumn = e.getColumn();
                        String strColName = dataModel.getColumnName(iColumn);
                        String strData = (String)dataModel.getValueAt(iRow,iColumn);
                        String strNextColumn = dataModel.getColumnName(iColumn+1);
                        dataModel.setValueAt(vctDBAccess.vctGetOidList().elementAt(vctDBAccess.iGetIndex(strData)+1),iRow,iColumn+1);
              /* Adding button to Frame     */
              JButton jbInsert = new JButton("Insert");
              /* Adding new row to the Tablemodel -- Probelm is here     */
              jbInsert.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                        try {
                   Object[] nrow = {"what", "ever", "you"};
                   dataModel.addRow(nrow);
                   }catch(Exception ex) {
                   System.out.println("Exception at adding row = " + ex);
    getContentPane().add(jbInsert);
    jbInsert.setBounds(100,350,100,20);
    addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent e) {
                   System.exit(0);
         /* Method to initialise new tablemodel     */
         public void myModel() {
              Object[][] data = { {new Integer(10),"two","three"},
                                                 {new Integer(5),"two","three"},
                                                 {new Integer(4),"two","three"},
              String[] col = { "First", "Second", "Third"};
              dataModel = new DefaultTableModel(data,col);
    public static void main(String arg[]) {
              TableImpl ct = new TableImpl();
              ct.setVisible(true);
    /* Class that returns a Vector of String for populating ComboBox entries and
              for getting the index of a particular element of the vector          */
    class ReturnVector {
                   Vector vctOidName=null;
                   ReturnVector() {
                        this.vctOidName = new Vector();
                        vAddOidList();
                   public void vAddOidList() {
                        String[] dbResult = {      "system", "1.3.6.1.2.1.1" ,
                                                      "interface", "1.3.6.1.2.1.2" ,
                                                      "snmp", "1.3.6.1.2.1.3" };
                        for(int i=0;i<dbResult.length;i++) {
                             System.out.println("Value = " + dbResult);
                             vctOidName.addElement(dbResult[i]);
                   public Vector vctGetOidList() {
                        return vctOidName;
                   public int iGetIndex(String strData) {
                        System.out.println("Index = " + vctOidName.indexOf(strData));
                        return vctOidName.indexOf(strData);

  • Problem with Lovs in same row of table

    Hi all,
    I am using two lovs in a row of advanced table.In first lov I am searching for few attributes and storing on of the values in a formValue(by using addLovRealtions(....,...,...,LOV_RESULT,...)). Based on this value I am using LOV_PASSIVE_CRITERIA to serach a value in second LOV. But when I am clicking on torch to search it's showing following message:
    you must enter a value for searchVersionId as criteria for LOV.
    where serachVersionId is formValue.
    But Same LOVs if used outside this table are working properly. Can you guys please help me to pass value to formValue. I am posting that code snippet also where I am setting Lov relations.
    //Set lov for Code
    OAFormValueBean versionId = (OAFormValueBean)
    webBean.findChildRecursive("searchVersionId");
    OAMessageLovInputBean codeSystem = (OAMessageLovInputBean)
    webBean.findIndexedChildRecursive("CodeSystemVersion");
    if(codeSystem!=null){
    codeSystem.addLovRelations(pageContext, "searchVersionId",
    "VersionId", LOV_RESULT, LOV_REQUIRED_YES);
    OAMessageLovInputBean code = (OAMessageLovInputBean)
    webBean.findIndexedChildRecursive("Code");
    if(code!=null){                               
    code.addLovRelations(pageContext, "searchVersionId",
    "VersionId", LOV_PASSIVE_CRITERIA, LOV_REQUIRED_YES);
    Message was edited by:
    user556665

    Adding the lovMaps will work for items outside the table at any point of time, since the ids dont get changed for LOVs. However inside the table, every lov in each row will go through some id transformation, this will not allow dynamic lov maps to be added after the Lovs are rendered. You should have them relations declaratively

  • Problem with checkbox group in row popin of table.

    In table row popin I have kept Check Box Group.I have mapped  the texts property of checkbox group to the attribute which is under the subnode of the table.the subnode properties singleton=false,selectioncardinality=0-n,and cardinality=0-n.
    if there are 'n' number of records in the table.each record will have its own row popin and in the row popin there is check box group.
    the check box group in the row popin  belongs to that perticular row.
    but the checkboxegroup values in row popins of all the  rows are getting changed to the row which is lead selected.
    The same scenario  (table in the row popin is showing the values corresponding to its perticular row and all the table values in popin are not getting changed to the one lead selected in the main table)is working fine with the table in place of  checkbox group in row popin with datasource property of table  binded to the subnode
    I cant trace out the problem with checkbox group in place of table.
    Please help me in this regard.I have to place check box group in place of table in row popin.
    Thanks and Regards
        Kiran Kumar K

    I have done the same thing successfully with normal check box ui element. Try using check box in your tabel cell editor instead of check box group.

  • Pages 08 fonts- problems with Arial, Times New Roman - how do I repair them?

    Pages 08 fonts- problems with Arial, Times New Roman - how do I repair them?
    Using 10.6.8 on MacBook Pro
    Mikeaaa

    I am running Snow Leopard. Transferring the same texts to TextEdit has no problems, so this is a Pages problem, I think.  Corruption of Times New Roman and Arial fonts, I suspect, but where? and what do I do about it? I just need to be pointed to a source of advice, I think.
    Thanks
    Mikeaaa

  • I how problems with delete/ fix alias

    I how problems with delete/fix alias. Somehow, I am trying to delete or fix alias by clicking the icon it show a pop-up saying to click "delete alias" or "fix alias." When I click "delete alias", it wouldn't let me. When I click "fix alias" I could not find what I am looking for. I try clicking different icon, but is show a pop-up saying "it could not be found (error code-43). Can someone help out????

    Moved to InDesign forum.
    You can start by telling us what the problem is.

  • Hai Matt  I have a problem with download a new app. While I bought iphone5, I take iphone to shopkeeper for download some app and videos that he used his Apple ID . That's t problem now.. Not all the time his ID is appearing but some times hi

    Hai Matt
    I have a problem with download a new app. While I bought iphone5, I take iphone to shopkeeper for download some app and videos that he used his Apple ID . That's t problem now.. Not all the time his ID is appearing but some times his Apple ID is appearing that time I can't download app, videos, songs.. So please guide me to remove that ID or how to solve that..
    Regards
    Babu

    Check Settings/iTunes and AppStore/AppleID and make sure that your AppleID is filled in. If not , sign out and sign in with the correct info.
    To make sure that no other apps or videos are on your device than the one you bought, set it up as new device, explained here: How to back up your data and set up as a new device
    Content that is not bought with your ID can't be used on your phone, that's why his ID and password is asked when you try to use those apps downloaded in the store.

  • Have a problem with deletting a folder that has lots over 100+ folders in it that are locked, please help

    Have a problem with deletting a folder that has 100+'s folders in it that are locked. Please help.

    Put the folder into the trash - go to the Finder menu and hold down the alt key whilst selecting Empty Trash.
    I've never tried this with a folder full of locked files, but it certainly works with a single locked file.
    Hope that helps!

  • Hello, I have a big batterylife problem with my brand new iPod touch 4Gen 8GB white. Please help...

    Hello, I have a big batterylife problem with my brand new iPod touch 4Gen 8GB white. Please help?

    What battery life are you getting?  Is it short when you are using the iPod? When it is sleeping?

  • Need to create a new row in table with same data as Primary key, but new PK

    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kale

    user9970447 wrote:
    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kalesomething like
    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')

  • Problems with email on new ipad not deleting?

    I have recently synced my new ipad 64gb 4g wifi from the back up from my ipad2. All was working fine & (no previous problems with my emails on ipad2) until I received an email a few days ago from apple which the original acknowledged changes to secutity questions. I have deleted the original from my desk top as some earlier forums have suggested but I am unable to delete or even open the email on the new ipad.When trying to action delete or open causes the mail app to instantly crash / close.So I am left with the mail icon app displaying 1 unopened message. I have again followed earlier recommendations namely completely deleting the mail account and starting from scratch only to be met with the same problem. When the mail app crashes all previous deleted messages re-appear in the inbox... Very frustrating any ideas would be gratefully received & any solutions would be terriffic!

    Have you tried closing the Mail app completely and then re-opening it ? From the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then also do a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Problem while adding a new row to the table.

    hello,
    In my ADF form i have a table. and when i click on CreateInsert it add a new to the table but at the first. i want all the new rows to be added at the end of the table in a sequence. how can i do this?....
    Thanks and Regards,
    Rakshitha

    Hi,
    Try this:
    DCIteratorBinding dciter;
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    dciter = (DCIteratorBinding) bindings.get("findAllTestAndryIter");
    ViewObjectImpl vo = dciter.getViewObject();
    if (vo != null)
    Row row = vo.createRow();
    int rangeSize = vo.getRangeSize();
    int rowsInRange = vo.getAllRowsInRange().length;
    int insertPos = rowsInRange < rangeSize? rowsInRange: rangeSize - 1;
    vo.insertRowAtRangeIndex(insertPos, row);
    vo.setCurrentRow(row);
    }

  • Problem in adding a new row in a table.. plsss hlppp

    Hi Friends,
    I have a table defaulted to 4 rows. I have a add button to add a new row in the table.
    When i have already 4 rows in table, and when i click add its adding that 5th row correctly( and i used set_lead_selection for this new row ).
    But i want to automatically make a next page once i hit the ADD button here. Each time now i m hitting next page then only  able to see hte 5th row. I need once ADD is clicked, i want to see the 5th row visible..
    Can someone tell me how to code or do this
    thanks friends,,,
    Niraja

    hi niraja,
    Plz refer to the following code:
    method onactiononadd .
    node_material type ref to if_wd_context_node.
    elem_material type ref to if_wd_context_element.
    stru_material type sflight.
    node_material =  wd_context->get_child_node( name = 'ANNA' ).
    elem_material = node_material->get_element(  ).
    if ( elem_material is initial ).
    call method node_material->create_element
    receiving
    element = elem_material.
    endif.
    call method elem_material->get_static_attributes
    importing
    static_attributes = stru_material .
    call method node_material->bind_structure
    exporting
    new_item = stru_material
    set_initial_elements = abap_false.
    endmethod.
    i hope it helps
    regards
    arjun

  • Receiver side JDBC - Problem with DELETE statement

    Hi,
    I have a scenario where in I need to delete legacy system data every time I run the interface before inserting new rows.
    I tried with stored procedure, by writing statement:
    Truncate <table>.
    Insert <records> into <table>.
    But problem is stored procedure is called every time so when run for the second time it deletes the 1st entry before placing 2nd. This way only last record is being fetched :(.
    Any suggestions?
    Thanks in Advance,
    Rohan.

    hi rohan,
    check the below blog , i think it solves your issue
    JDBC Adapter execution mode Chained or Unchained
    JDBC Adapter execution mode Chained or Unchained ??
    reward points if helpfull
    regards
    kummari

Maybe you are looking for

  • Setting page breaks...how?

    I am new to numbers... How do you set a page break? In print view, I would expect to simply drag the lines that represent the page breaks to in between the columns where I want the break, but that does not work. I have a spread sheet that is 1 page t

  • Macbook and Macbook Pro in same location getting different signals

    My wife has a Macbook and I have a Macbook Pro. We'll both be in practically the exact same spot (computers literally right next to each other) and her Macbook will pick up and be able to connect to multiple wireless networks and my Macbook Pro won't

  • 3rd Party Sales Issue

    Dear Guru's We have a process for creating 3rd Party Sales Order which use the standard TAS item category. SO is created and we then manually create a Purchase Order based on the Pur Req created when the Sales Order was saved. This all works fine. Wh

  • Can't access Home Page - Oracle Database 10g Express Edition...

    Hi, I have been running the Oracle Database 10g Express Edition on my Windows XP machine for years from this location: C:\Applications\OracleDatabaseExpress\app\oracle\product\10.2.0\server\Database_homepage.url In Properties of the Database_homepage

  • Can I create a canvas in Aperture?

    Hi, I need to order 5x7 images on 8x10 sheets on line. Apparently, in Photoshop, one creates a canvas to one's specifications and then send the new file to be printed accordingly. How do we achieve that in Aperture? Can we? I  know it can be done whe