Problems deleting current row

Hello,
I have got the following problem. I have got a table with data from my database. And a dataprovider to fetch the data from my rowset. I have got a button in each row of this table where i can get details or delete the corresponding row.
But when i click delete he wont delete the row correct. After a while i realised that the always fetch the same row. I dont understand why because i took the same code as it was used in the tutorial. For control i made a variable to remember the id of the fetched row but it wont change after the first "delete". Can somebody tell me why he wont change the value?
public String l�schen_action() {
try {
RowKey rowKey = tableRowGroup1.getRowKey();
int id = getSessionBean1().getMaxappid().parseInt(applikationDataProvider.getValue("APPID", rowKey).toString(), 10);
getSessionBean1().setTemp(id);
if(rowKey != null && applikationDataProvider.canRemoveRow(rowKey)){
applikationDataProvider.removeRow(rowKey);
applikationDataProvider.commitChanges();
applikationDataProvider.refresh();
} catch (Exception e) {
log("Fehler beim L\366schen des Eintrags", e);
error("Exception deleting row: " + e);
} // end try catch
return null;
Thanks in advance for help
Acinonyx

Try this and see if that helps
Rowkey currentRowKey = (RowKey) getBean("currentRow");
- Winston
http://blogs.sun.com/roller/page/winston?catname=Creator

Similar Messages

  • Problem with Current row of a VO???

    I have a Advanced table region in which i add many rows..and i get the data in to it from the lov page (lov mappings).
    for each row i add... i have to set a item in main page table region doing some validations the data i get from lov region.
    with examples..more detailed..
    i have paymentAmount and AllocAmount...i get the payment Amount from LOV...after doing some validation on paymnetAmount i have to set the same value to the AllocAmount.
    ARTransactionLine is the VO which contains the above mentioned attributes....and advanced table i mentioned above is based on this VO.
    for this purpose im using the following code..
    ARTransactionLineVOImpl
    vo=(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.getCurrentRow();
    payment_amount = TransDetailsVORow.getPaymentAmount();/*for this paymentAmount i made a lov mapping..so that currentrow contains the value of paymnetAmount from lov page*/
    if(/* some validation*/){
    TransDetailsVORow.setAllocAmount(payment_amount);
    now when i do this ..for the first row it is working fine...but for the second row it is failing...getCurrentRow() is giving the values of previous row..not the current row...
    first of all what does this getCurrentRow return???
    help me ...n tell me where i was wrong...

    I m sure you have not gone through the tutorials completely.
    ARTransactionLineVOImpl vo =(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.getCurrentRow();
    with this row i am doing the below opeations..
    Number x=TransDetailsVORow.getPaymentAmount();
    /* some validations*/
    TransDetailsVORow.setAllocAmount(x);
    Change to
    ARTransactionLineVOImpl vo =(ARTransactionLineVOImpl)findViewObject("ARTransactionLineVO1");
    ARTransactionLineVORowImpl TransDetailsVORow = (ARTransactionLineVORowImpl)vo.first();
    while (TransDetailsVORow!=null)
    Number x=TransDetailsVORow.getPaymentAmount();
    /* some validations*/
    TransDetailsVORow.setAllocAmount(x);
    TransDetailsVORow = (ARTransactionLineVORowImpl)vo.next();
    Tapash

  • BC4J: Problem deleting a row with clob field

    When I try to delete a row that contains a CLOB field.
    When I call the function removeCurrentRow in my View object I get this exception:
    JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
    Could anyone tell me why I can't remove the row? Thanks in advance!
    null

    This looks like a bug in TreeBinding. Please file this as a bug/tar with OracleSupport with your reproducible testcase (or steps to reproduce). Thanks.

  • Problems deleting last row of table

    I have tried a number of examples to make a button delete the LAST row of a table, but I cannot make it.
    This is the script I am currently using, but it only delets the second row. I'm desperate, I don't know where's the mistake. Please help!
    var sSubformSOM = "xfa.form.Summary.INTrack.INRecordTable.INRecord.Row1";
    var bCalc = true;
    var message = "You have reached the maximum number of items allowed.";
    var oSubform = xfa.resolveNode(sSubformSOM);
    var sParentSOM = oSubform.parent.somExpression;
    var sManagerSOM = sParentSOM + "._" + oSubform.name;
    var oManager = xfa.resolveNode(sManagerSOM);
    var nMinCount = oManager.occur.min;
    var nSubCount = oManager.count;
    if (nSubCount > nMinCount) {
              oManager.removeInstance(1);
              if (bCalc == true) {
                        xfa.form.recalculate(1);
    } else {
              xfa.host.messageBox(message,"Remove Item", 3);

    Hi
    In fact what you want is somehow strange. But this may be used.
    For the first row:
    <b>SELECT * FROM <table_name> UP TO 1 ROWS
    INTO gs_record</b>
    <i>*-- If you want you can use <b>"ORDER"</b> statement here to order *the contents</i><b>.</b>
    For the last row:
    As far as I know, You should select all the records till the last row and then get the last row.
    But, I think without ordering it will be somehow weird. We do not deal how the database layer handles order of the table. It has different policies regarding indexes etc... If you have an ordering condition, I think it will often be more convenient using an internal table to handle data. That is, retrieve your data with SELECT statement into an internal table, sort it and read it.
    *--Serdar

  • Problem Deleting a row from the bottom level of a tree binding

    We have the following requirement: To allow user to delete an item on an order (which is the lowest level node in tree) by updating the quantity textbox to zero in a jsp page.
    We display a listing of Ad Items for a Department with quantity textboxes. The user enters quantities and clicks on “add to my order” button. The items in which they have entered quantities for are persisted to a database table. The user is then directed to an order summary screen (shown below) where it displays the items and quantities for which they have placed an order for. The quantities are updateable. If the user changes a quantity to zero, we want to remove that item from the Order Items View Object (all VOs described are Entity based).
    Update Screen - click here (http://members.awiweb.com/images/adspl_summary.jpg)
    We are using a 3-level tree binding
    -- Department Level
    ---- Ad Items Level (items that they can order)
    ------ Order Items Level (items that they have ordered)
    Attributes on the Order Items View Object:
    ConfoOrderDeptId (key attribute)
    Itemcode (key attribute)
    DeliveryDate (key attribute)
    Quantity
    Customercode
    Custom method in the app module:
    //Gets the VO for the Order Items Level
    ConfoOrderItemEOVOImpl confoOrderItem = (ConfoOrderItemEOVOImpl)getConfoOrderItemEOVO1();
    //Creates an Object from the values being passed into the custom method.
    //There is a value for each key attribute in the Order Items VO
    Object [] myKeyObj = new Object[]{confoOrderDeptId,itemcode,date};
    Key myKey = new Key(myKeyObj);
    Row [] orderItemRow = confoOrderItem.findByKey(myKey,1);
    //newQty is updated quantity
    if ("0".equals(newQty))
    orderItemRow[0].remove();
    else
         orderItemRow[0].setAttribute("Quantity",newQty);
    The updates (setAttribute) is working fine. The deletes (.remove()) is throwing a null pointer exception (see stack trace below).
    We also tried overloading the setQuantity method in the RowImple class and called this.remove() if the quantity being passed in was zero, but we got the same null pointer result.
    04/08/27 16:57:29 java.lang.NullPointerException
    04/08/27 16:57:29      at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.myUpdateValuesFromRows(JUCtrlHierNodeBinding.java:419)
    04/08/27 16:57:29      at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.updateRowDeleted(JUCtrlHierNodeBinding.java:326)
    04/08/27 16:57:29      at oracle.jbo.uicli.binding.JUIteratorBinding.rowDeleted(JUIteratorBinding.java:220)
    04/08/27 16:57:29      at oracle.jbo.common.RowSetHelper.fireRowDeleted(RowSetHelper.java:222)
    04/08/27 16:57:29      at oracle.jbo.server.ViewRowSetIteratorImpl.deliverRowDeletedEvent(ViewRowSetIteratorImpl.java:3026)
    04/08/27 16:57:29      at oracle.jbo.server.ViewRowSetIteratorImpl.notifyRowDeleted(ViewRowSetIteratorImpl.java:2915)
    04/08/27 16:57:29      at oracle.jbo.server.ViewRowSetImpl.notifyRowDeleted(ViewRowSetImpl.java)
    04/08/27 16:57:29      at oracle.jbo.server.ViewObjectImpl.notifyRowDeleted(ViewObjectImpl.java:6565)
    04/08/27 16:57:29      at oracle.jbo.server.ViewObjectImpl.notifyRowDeleted(ViewObjectImpl.java:6603)
    04/08/27 16:57:29      at oracle.jbo.server.QueryCollection.removeRow(QueryCollection.java:2118)
    04/08/27 16:57:29      at oracle.jbo.server.QueryCollection.afterRemove(QueryCollection.java:2083)
    04/08/27 16:57:29      at oracle.jbo.server.ViewObjectImpl.sourceChanged(ViewObjectImpl.java:7770)
    04/08/27 16:57:29      at oracle.jbo.server.EntityCache.sendEvent(EntityCache.java:616)
    04/08/27 16:57:29      at oracle.jbo.server.EntityCache.deliverEntityEvent(EntityCache.java:642)
    04/08/27 16:57:29      at oracle.jbo.server.EntityCache.notifyStateChange(EntityCache.java:763)
    04/08/27 16:57:29      at oracle.jbo.server.EntityImpl.setState(EntityImpl.java:2875)
    04/08/27 16:57:29      at oracle.jbo.server.EntityImpl.remove(EntityImpl.java:5548)
    04/08/27 16:57:29      at oracle.jbo.server.ViewRowImpl.doRemove(ViewRowImpl.java:1773)
    04/08/27 16:57:29      at oracle.jbo.server.ViewRowImpl.remove(ViewRowImpl.java:1813)
    04/08/27 16:57:29      at com.awiweb.om.model.dataaccess.ConfoOrderItemEOVORowImpl.setQuantity(ConfoOrderItemEOVORowImpl.java:112)
    04/08/27 16:57:29      at com.awiweb.om.model.services.ConfoOrderingAppModuleImpl.updateConfoOrderItemWithValues(ConfoOrderingAppModuleImpl.java:247)
    04/08/27 16:57:29      at com.awiweb.om.view.CurrentOrderSummaryAction.onUpdateCurrentOrder(CurrentOrderSummaryAction.java:39)
    04/08/27 16:57:29      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    04/08/27 16:57:29      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
    04/08/27 16:57:29      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    04/08/27 16:57:29      at java.lang.reflect.Method.invoke(Method.java)
    04/08/27 16:57:29      at oracle.adf.controller.lifecycle.PageLifecycle.handleEvent(PageLifecycle.java:512)
    04/08/27 16:57:29      at oracle.adf.controller.struts.actions.StrutsPageLifecycle.handleEvent(StrutsPageLifecycle.java:211)
    04/08/27 16:57:29      at oracle.adf.controller.lifecycle.PageLifecycle.processComponentEvents(PageLifecycle.java:447)
    04/08/27 16:57:29      at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:246)
    04/08/27 16:57:29      at oracle.adf.controller.struts.actions.DataAction.processComponentEvents(DataAction.java:440)
    04/08/27 16:57:29      at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:114)
    04/08/27 16:57:29      at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:233)
    04/08/27 16:57:29      at com.awiweb.om.ext.AWIDataAction.handleLifecycle(AWIDataAction.java:191)
    04/08/27 16:57:29      at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:163)
    04/08/27 16:57:29      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    04/08/27 16:57:29      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    04/08/27 16:57:29      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
    04/08/27 16:57:29      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
    04/08/27 16:57:29      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    04/08/27 16:57:29      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    04/08/27 16:57:29      at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    04/08/27 16:57:30      at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    04/08/27 16:57:30      at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    04/08/27 16:57:30      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:228)
    04/08/27 16:57:30      at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
    04/08/27 16:57:30      at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    04/08/27 16:57:30      at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    04/08/27 16:57:30      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    04/08/27 16:57:30      at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    04/08/27 16:57:30      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    04/08/27 16:57:30      at java.lang.Thread.run(Thread.java:534)

    This looks like a bug in TreeBinding. Please file this as a bug/tar with OracleSupport with your reproducible testcase (or steps to reproduce). Thanks.

  • Need Help ::  Current row attribute value returning null

      Hi Frds,
    I am facing the problem that
    Current row attribute value returning null............ even though value is there..... plz.. he
    This is the code in PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
        String  pPersonId = pageContext.getParameter("ctrlPersonId");
         String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
         OptionsVORowImpl curRow = (     OptionsVORowImpl) am.findRowByRef(rowReference);
        String dtlsItem =  (String)curRow.getFlexValue();   /*  this is returning null value */
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks & Regards,
    jaya
    Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810

    Hi Jaya,
    You want to catch Flexfield values?
    Try below code for catch value.
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
    OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
    OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
    OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
    String dtlsItem  = (String)Stylebean.getText(pageContext);
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks,
    Dilip

  • Need to Set Current Row when Using Built-in Data Control Delete Operation?

    I have an af:table bound to a ViewObject (VO) collection (no Entity Object) - within each row, I include a column that contains a 'Remove' command button so the user can remove the row. I add the command button by dragging/dropping the built-in delete operation from the VO on the Data Control Palette. When I use this as is (no changes), the Remove button always deletes the first row in the collection, not the selected row. Do I need to add code to set the current row, and if so can someone please provide an example and specify where I need to add? thanks.
    ------ .jspx af:table with command button to remove each row ------
    <af:table value="#{bindings.ListView1.collectionModel}" var="row"
    rows="#{bindings.ListView1.rangeSize}"
    first="#{bindings.ListView1.rangeStart}"
    // note: I don't have any code added for selectedRow or makeCurrent - assuming this is built-in?
    selectionState="#{bindings.ListView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.ListView1.collectionModel.makeCurrent}">
    <af:column>
    <af:commandButton actionListener="#{bindings.Delete.execute}"
    text="Remove"
    disabled="#{!bindings.Delete.enabled}"/>
    </af:column>
    ---------- corresponding pagedef file ------------
    <bindings>.....
    <action id="Delete" IterBinding="ListView1Iterator"
    InstanceName="SrchDataControl.ListView1"
    DataControl="SrchDataControl" RequiresUpdateModel="false"
    Action="30"/>
    </bindings>
    Note: I also tried solution posted on following thread, but again, only first row is deleted, not the selected row?: Delete and Commit
    Message was edited by:
    javaX

    I just want to delete (or remove) it from the VO. Data for this VO is not on the database.
    The function is doing what I want it to do (delete from the VO), its just always deleting the first row, versus the selected row. I select the command button next on a column next to an item further down in the list and it deletes the first row. The problem is setting the selected row to be removed - I thought setting the current row would be taken care of by the SelectListener?
    selectionState="#{bindings.MyIspListView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.MyIspListView1.collectionModel.makeCurrent}"

  • Problem of deletion of rows in jtable, table refreshing too

    Hi,
    I have a table with empty rows in the beginning with some custom properties( columns have fixed width...), later user would be adding to the rows to this table and can delete, I've a problem while deleting the rows from table,
    When a selected row is deleted the model is also deleting the data but the table(view) is not refreshed.
    Actually i'm selecting a cell of a row, then hitting the delete button.
    So the model is deleting the information, but i'm not able to c the fresh data in table( especially when the last cell of last row is selectd and hit the delete button, i am getting lots of exception)
    Kindly copy the below code and execute it, and let me know,
    * AuditPanel.java
    * Created on August 30, 2002, 3:05 AM
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.util.Vector;
    * @author yaman
    public class AuditPanel extends javax.swing.JPanel {
    // These are the combobox values
    private String[] acceptenceOptions;
    private Vector colNames;
    private Color rowSelectionBackground = Color.yellow;
    private int rowHeight = 20;
    private int column0Width =70;
    private int column1Width =96;
    private int column2Width =327;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    /** Creates new form AuditPanel */
    public AuditPanel() {
    public void renderPanel(){
    initComponents();
    public String[] getAcceptenceOptions(){
    return acceptenceOptions;
    public void setAcceptenceOptions(String[] acceptenceOptions){
    this.acceptenceOptions = acceptenceOptions;
    public Vector getColumnNames(){
    return colNames;
    public void setColumnNames(Vector colNames){
    this.colNames = colNames;
    public Vector getData(){
    Vector dataVector = new Vector();
    /*dataVector.add(null);
    dataVector.add(null);
    dataVector.add(null);
    return dataVector;
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    jPanel2 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jTable1 = new javax.swing.JTable();
    setLayout(new java.awt.GridBagLayout());
    setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jPanel2.setLayout(new java.awt.GridBagLayout());
    jPanel2.setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jButton1.setText("Add");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 8;
    gridBagConstraints.insets = new java.awt.Insets(0, 1, 5, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton1, gridBagConstraints);
    jButton2.setText("Delete");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    add(jPanel2, gridBagConstraints);
    jPanel1.setLayout(new java.awt.GridBagLayout());
    jPanel1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED, Color.black, Color.gray) );
    jTable1.setModel(new javax.swing.table.DefaultTableModel(getData(), getColumnNames()));
    // get all the columns and set the column required properties
    java.util.Enumeration enum = jTable1.getColumnModel().getColumns();
    while (enum.hasMoreElements()) {
    TableColumn column = (TableColumn)enum.nextElement();
    if( column.getModelIndex() == 0 ) {
    column.setPreferredWidth(column0Width);
    column.setCellEditor( new ValidateCellDataEditor(true) );
    if( column.getModelIndex() == 1) {
    column.setPreferredWidth(column1Width);
    column.setCellEditor(new AcceptenceComboBoxEditor(getAcceptenceOptions()));
    // If the cell should appear like a combobox in its
    // non-editing state, also set the combobox renderer
    //column.setCellRenderer(new AcceptenceComboBoxRenderer(getAcceptenceOptions()));
    if( column.getModelIndex() == 2 ) {
    column.setPreferredWidth(column2Width); // width of column
    column.setCellEditor( new ValidateCellDataEditor(false) );
    jScrollPane1 = new javax.swing.JScrollPane(jTable1);
    jScrollPane1.setPreferredSize(new java.awt.Dimension(480, 280));
    jTable1.setMinimumSize(new java.awt.Dimension(60, 70));
    //jTable1.setPreferredSize(new java.awt.Dimension(300, 70));
    //jScrollPane1.setViewportView(jTable1);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    jPanel1.add(jScrollPane1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    add(jPanel1, gridBagConstraints);
    // set the row height
    jTable1.setRowHeight(rowHeight);
    // set selection color
    jTable1.setSelectionBackground(rowSelectionBackground);
    // set the single selection
    jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // avoid table header to resize/ rearrange
    jTable1.getTableHeader().setReorderingAllowed(false);
    jTable1.getTableHeader().setResizingAllowed(false);
    // Table header font
    jTable1.getTableHeader().setFont( new Font( jTable1.getFont().getName(),Font.BOLD,jTable1.getFont().getSize() ) );
    jButton1.setMnemonic(KeyEvent.VK_A);
    // action of add button
    jButton1.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){
    //System.out.println("table is edition ");
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // find out total available rows
    int totalRows = jTable1.getRowCount();
    int cols = jTable1.getModel().getColumnCount();
    if( jTable1.getModel() instanceof DefaultTableModel ) {
    ((DefaultTableModel)jTable1.getModel()).addRow(new Object[cols]);
    int newRowCount = jTable1.getRowCount();
    // select the first row
    jTable1.getSelectionModel().setSelectionInterval(newRowCount-1,newRowCount-1);
    jButton2.setMnemonic(KeyEvent.VK_D);
    // action of Delete button
    jButton2.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    int totalRows = jTable1.getRowCount();
    // If there are more than one row in table then delete it
    if( totalRows > 0){
    int selectedOption = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete this audit row?","Coeus", JOptionPane.YES_NO_OPTION);
    // if Yes then selectedOption is 0
    // if No then selectedOption is 1
    if(0 == selectedOption ){
    // get the selected row
    int selectedRow = jTable1.getSelectedRow();
    System.out.println("Selected Row "+selectedRow);
    if( selectedRow != -1 ){
    DefaultTableModel dm= (DefaultTableModel)jTable1.getModel();
    java.util.Vector v1=dm.getDataVector();
    System.out.println("BEFOE "+v1);
    v1.remove(selectedRow);
    jTable1.removeRowSelectionInterval(selectedRow,selectedRow);
    System.out.println("After "+v1);
    }else{
    // show the error message
    JOptionPane.showMessageDialog(null, "Please Select an audit Row", "Coeus", JOptionPane.ERROR_MESSAGE);
    } // end of initcomponents
    class AcceptenceComboBoxRenderer extends JComboBox implements TableCellRenderer {
    public AcceptenceComboBoxRenderer(String[] items) {
    super(items);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
    setForeground(table.getSelectionForeground());
    super.setBackground(rowSelectionBackground);
    } else {
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    // Select the current value
    setSelectedItem(value);
    return this;
    class AcceptenceComboBoxEditor extends DefaultCellEditor {
    public AcceptenceComboBoxEditor(String[] items) {
    super(new JComboBox(items));
    } // end editor class
    public class ValidateCellDataEditor extends AbstractCellEditor implements TableCellEditor {
    // This is the component that will handle the editing of the
    // cell value
    JComponent component = new JTextField();
    boolean validate;
    public ValidateCellDataEditor(boolean validate){
    this.validate = validate;
    // This method is called when a cell value is edited by the user.
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int rowIndex, int vColIndex) {
    if (isSelected) {
    component.setBackground(rowSelectionBackground);
    // Configure the component with the specified value
    JTextField tfield =(JTextField)component;
    // if any vaidations to be done for this cell
    if(validate){
    //tfield.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC,4));
    tfield.setText( ((String)value));
    // Return the configured component
    return component;
    // This method is called when editing is completed.
    // It must return the new value to be stored in the cell.
    public Object getCellEditorValue() {
    return ((JTextField)component).getText();
    // This method is called just before the cell value
    // is saved. If the value is not valid, false should be returned.
    public boolean stopCellEditing() {
    String s = (String)getCellEditorValue();
    return super.stopCellEditing();
    public void itemStateChanged(ItemEvent e) {
    super.fireEditingStopped();
    }//end of ValidateCellDataEditor class
    public static void main(String args[]){
    JFrame frame = new JFrame();
    AuditPanel auditPanel = new AuditPanel();
    frame.getContentPane().add(auditPanel);
    auditPanel.setAcceptenceOptions(new String[]{"Accepted", "Rejected", "Requested"} );
    java.util.Vector colVector = new java.util.Vector();
    colVector.add("Fiscal Year");
    colVector.add("Audit Accepted");
    colVector.add("Comment" );
    auditPanel.setColumnNames( colVector);
    auditPanel.renderPanel();
    frame.pack();
    frame.show();

    Hi,
    I've got the solution for it. As when the cursor is in cell of
    a row and hit the delete button, the data in that cell is not saved,
    So i'm trying to save the data first into the model then firing the action event by doing this ..
    jButton2.addActionListener( new ActionListener(){       
    public void actionPerformed(ActionEvent actionEvent){           
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){                   
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // HERE DO THE DELETE ROW OPERATION
    <yaman/>

  • Problem in deleting a row

    hi,
    I have a table with set of values.  added three buttons below that in table. add row, delete row, save.
    if I delete the row and save and if i come again to that application still that deleted row remains. what might be the problem?

    you can use flag in your internal table,
    when you press delete button after selecting the particular row, set the flag for this entry in itab.
    now in save event loop through the table checking flag, and delete enteries. now bind the table again by the itab.
    you can do the same thing in delete button event also,
    if not solved, please explain more
    Yogesh N

  • Problem with multi row delete

    Hi, I'm new in apex and I tried to build master detail report on some view. Everything is cool but "delete checked" doesn't work.
    "ORA-20001: Error in multi row delete operation: row= , ORA-06502: PL/SQL: numeric or value error: NULL index table key value,"
    the problem is that I don't know what is wrong :), I have a special trigger "instead of delete on MY_VIEW", but in this error problem is not explained.
    Anybody knows what can be wrong? It is probably a problem with trigger or multi row doesn't work with views? I couldn't find how MRD knows what kind of statement use to delete rows so I don't know if the statement that program used is correct. In debug it lokks that:
    0.32: ...Do not run process "ApplyMRU", process point=AFTER_SUBMIT, condition type=REQUEST_IN_CONDITION, when button pressed=
    0.32: ...Process "ApplyMRD": MULTI_ROW_DELETE (AFTER_SUBMIT) #OWNER#:MY_VIEW:ITEM1:ITEM2
    0.33: Show ERROR page...
    0.33: Performing rollback...
    thanks for any help
    //sorry for english mistakes
    edit: it doesn't matter if I use in trigger delete from ... where item1=:OLD.item1 ; or if I use item1=:P4_item1 (which actually saves correct values)
    Edited by: user5931224 on 2009-06-13 08:55

    I realised that this is not a problem with trigger, I changed trigger to "NULL;" and problem is the same. Maybe sb used master detail on view not only on tables and know what can be wrong in this situation?

  • Problem deleting rows using JDBC

    Hi,
    I have a problem with the following code listed below. I am attempting to delete a user's details from a SQLServer db based on the user selected from a combobox. The code given below is just a section and relates to a JButton I have on the application that performs the delete command.
    public void deleteButton_actionPerformed(ActionEvent e) {
    try{
    String opName = (String)userNameBox.getSelectedItem();
    String deleteQuery = "select * from Operator where OperatorName = " + "'"+opName+"'";
    //Load Database Driver Class
    Class.forName(JDBC_DRIVER);
    //Establish a connection to the Database
    connection = DriverManager.getConnection(DATABASE_URL);
    //Create Select statement for returning all usernames to the combobox
    statement2 = connection.createStatement(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
    //dQuery.setString(1,opName);
    resultSet = statement2.executeQuery(deleteQuery);
    while (resultSet.next()){
    resultSet.deleteRow();
    catch(Exception exception){
    exception.printStackTrace();}
    To explain the code, to begin with a String holds the value of the selected field of the combobox i have in my app. I have the SQL select statement the using this variable as the where clause.
    The usual connection and statement objects are declared etc and then the query is executed. Within the While loop I then attempt to delete the row that the query has retrieved for me. However this results in the following error.
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid attribute/option identifier
    Any help is much appreciated.
    Thanks
    Alan

    Thanks for the reply. I understand your comment about
    using the delete statement and it seems I am making
    an obvious error. However I was using the select
    statement to generate a resultSet object with which I
    can delete elements from. Hence the reason for the
    use of the select statement.This is brain dead, the classic newbie mistake. The database vendor has optimized their code more than you ever will in making those deletes, so use their code. Not only will they do it faster than you will, but you'll save yourself (n+1) network roundtrips (1 for the SELECT, 1 for each DELETE you issue). Better to learn SQL and use a WHERE clause to do it on the database side.
    You have however solved the problem I had with
    directly executing the delete statement as an SQL
    String. I was using the following statement:
    String deleteQuery = "select * from Operator where
    OperatorName = " + "'"+opName+"'";
    The wildcard character is not required and it was
    this that gave me problems and made me look to using
    a select query and deleting results from a
    resultSet.Sounds like you need a SQL book. I recommend "SQL For Smarties".
    %

  • Bizarre Problem for table row deletion.please help

    Folks
    I am facing a most BIZARRE PROBLEM!!!
    I have a table with a deleteButton by the side.
    The table has 3 rows
    ABC-----DELETE
    BCD-----DELETE
    VDG-----DELETE
    I click on the delete Button of the first row,the record gets deleted from the table,
    Now there are 2 records..
    BCD-----DELETE
    VDG--- -DELETE
    I click on the delete Button of the first row,and I get the error
    java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -1
    The table.getSelectedRow() becomes -1 automatically...
    Now if I comment out the Table deletion statements, and I click on any delete Button
    i get the correct messages
    You clicked row : 1
    you clicked row : 2
    After deletion of the first record,i am unable to delete the 2nd record,i get the
    error above.
    any suggestions
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("Table Row clicked is : " + table.getSelectedRow());
    // Delete row from window.
    ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
    table.revalidate();
    };

    after deleting the row call this method
    fireTableRowsDeleted()
    -Ashish

  • Current Row Problem

    Hi,
    I am using advance table to use add row functionality. I am handling add row functionality manually. I am using setCurrentRow method to choose current row.
    So It treats the last added row as current row. But We have one requirement ,
    In my table we have one LOV, For this LOV i need to use VOs dynamically according to current rownumber and some other values. So i need to identify the current row while I click the LOV. How should i find current row while i click LOV in a particular ROw?
    Anybody can help me? Please.................

    There is something called rowReference which can be used in your case. Then you can find the current row in the table using rowreference. There are many threads related to that. You can either go through these threads and/or refer the Dev Guide.

  • The detail part of table doesn't refresh after deleting a row

    Hello!
    I'm developing a Master-Detail table with some a functionality. Particularly, I want to invoke a DELETE function in the Detail part of the table.
    For this purpose, I placed a Command button to the tableSelectOne component of the Detail part of the table, which stores current row key and calls another page. On this (<another>) page I created a ReadOnly form with data related to the row of Detail table, which key is stored. In addition, I added there two Command buttons. First of them is a CancelButton, which does nothing except returning to master-detail page. The second is a DeleteButton, which executes a RemoveEntity method and returns to master-detail page, too.
    When I'm tried to delete in this way a row from detail part of table, I discovered, that this row is really deleted from the database, but it doesn't affect on the content of the Detail part of the table. Any kinds of refreshing couldn't aid me, only restart of the application.
    Could anybody help me to solve this problem?
    Thank in advance.

    Hi,
    I'm facing the same problem but Frank's solution doesn't fix it.
    you need to define an invoke action in the binding
    for your m/d page and set it into the page binding's
    execute section. Then set the condition for invoking
    the action to !postback. This will re-execute the
    iteratorThis efectively re-executes the iterator, so the master table data is refreshed. You can see the TopLink log showing the query to the db (I'm using TopLink instead of BC). The problem is that the detail rows are queried only once and only the inserts and updates are displayed, not the deletes.
    I think the problem may be related to PPR or some cache issue.
    See the BC tutorial
    http://www.oracle.com/technology/obe/ADFBC_tutorial_10
    13/ADFBC_tutorial.pdf
    See page 86 "Adding the ServiceHistories Data". This
    defines a invoke action for this kinf of task. More
    example code is contained in the SRDemo sampleThe tutorial doesn't contain a scenario with master-detail deleting detail records (neither the BC tutorial, nor the TopLink one) so it can't help me :(
    The only solution I can think of is using a different model method (a method in the SessionFacade for TopLink) for the detail table (one that takes the master PK as parameter and retrieves the corresponding detail records) and have a selectionListener in the selection component of the master re-execute the method (passing the PK from the master table current row).
    Is there a solution that doesn't require the use of a separate method for the detail?
    Thanks,
    Miguel

  • Delete operation is not working to delete selected row from ADF table

    Hi All,
    We are working on jdev 11.1.1.5.3. We have one ADF table as shown below. My requirement is to delete a selected row from table, but it is deleting the first row only.
    <af:table value="#{bindings.EventCalendarVO.collectionModel}" var="row"
    rows="#{bindings.EventCalendarVO.rangeSize}"
    emptyText="#{bindings.EventCalendarVO.viewable ? applcoreBundle.TABLE_EMPTY_TEXT_NO_ROWS_YET : applcoreBundle.TABLE_EMPTY_TEXT_ACCESS_DENIED}"
    fetchSize="#{bindings.EventCalendarVO.rangeSize}"
    rowBandingInterval="0"
    selectedRowKeys="#{bindings.EventCalendarVO.collectionModel.selectedRow}"
    selectionListener="#{bindings.EventCalendarVO.collectionModel.makeCurrent}"
    rowSelection="single" id="t2" partialTriggers="::ctb1 ::ctb3"
    >
    To perform delete operation i have one delete button.
    <af:commandToolbarButton
    text="Delete"
    disabled="#{!bindings.Delete.enabled}"
    id="ctb3" accessKey="d"
    actionListener="#{AddNewEventBean. *deleteCurrentRow* }"/>
    As normal delete operation is not working i am using programatic approach from bean method. This approach works with jdev 11.1.1.5.0 but fails on ver 11.1.1.5.3
    public void deleteCurrentRow (ActionEvent actionEvent) *{*               DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("EventCalendarVOIterator");
    // Get an object representing the table and what may be selected within it
    ViewObject eventCalVO = dcItteratorBindings.getViewObject();
    // Remove selected row
    eventCalVO.removeCurrentRow();
    it is removing first row from table still. Main problem is not giving the selected row as current row. Any one point out where is the mistake?
    We have tried the below code as well in deleteCurrentRow() method
    RowKeySet rowKeySet = (RowKeySet)this.getT1().getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.getT1().ggetValue();
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();
    rowData.getRow().remove();
    The same behavior still.
    Thanks in advance.
    Rechin
    Edited by: 900997 on Mar 7, 2012 3:56 AM
    Edited by: 900997 on Mar 7, 2012 4:01 AM
    Edited by: 900997 on Mar 7, 2012 4:03 AM

    JDev 11.1.1.5.3 sounds like you are using oracle apps as this not a normal jdev version.
    as it works in 11.1.1.5.0 you probably hit a bug which you should file with support.oracle.com...
    Somehow you get the first row instead of the current row (i guess). You should debug your code and make sure you get the current selected row in your bean code and not the first row.
    This might be a problem with the bean scope too. Do you have the button (or table) inside a region? Wich scope does the bean have?
    Anyway you can try to remove the iterator row you get
    public void deleteCurrentRow (ActionEvent actionEvent) { DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("EventCalendarVOIterator");
    dcItteratorBindings.removeCurrentRow();Timo

Maybe you are looking for

  • Business Objects - Lifecyle Management Services

    Is there anyone who knows about BOE LCM?  We are planning to install a 3-tier (Dev/QA/Prod) Business Objects environments.  Our desire is to develop in Dev, move to QA for testing and Prod.  We would prefer not to have end users develop Xcelsius dash

  • Cannot read/write error message when synching

    I've been doing my best to get my iPod up to date, but every time I try to sync the message that the drive is not able to be read from or written to appears about an tenth of the way in. I've restored my iPod and updated iTunes but the message contin

  • Footage changes when converting CS4 project to CC project

    I have many CS4 projects that I have converted to CC. Some of these CS4 projects had footage defined as a subset of images in a folder.  For example: Animation_[00000-00089].png = "C:\example\Animation_00000.png" through "C:\example\Animation_00089.p

  • How cai I set up the cihper in a SSTP VPN?

    I am using a SSTP VPN, but I don't know if the connection is ciphered or not, because in no place I need to set up de cipher, only I can set the certificates, but if I am not wrong, the certificates are used to authentication, not to cipher the conne

  • Bilder mit farblichem Rand erstellen und drucken

    Hallo, ich möchte Bilder als Postkarte ausdrucken. Das Bild soll aber nicht die ganze Fläche ausfüllen. Es soll ein Rand bestehen bleiben. Diesen Rand möchte ich nun von Bildrand bis zum Papierrand mit individuellen Farben gestalten. Wie kann ich die