Af:table refresh

Hello!
I have JSPX page with inputText and af:table. User enters inputText value then Managed bean (parveidotajs) takes it and do some data inserts (JDBC) in database table RegresijasPunkti. So af:table and all bindings doesn't know that data was changed.
How can I refresh values of af:table (populated from table RegresijasPunkti)?
.JSPX source:
<af:inputText label="InputText" id="it5" value="#{parveidotajs.ievade}" rows="10" autoSubmit="true”/>
<af:table value="#{bindings.RegresijasPunktiView1.collectionModel} id="t1" ...>

I'll try to explain scenario:
1) User enters value in inputText
2) This values goes (autoSubmit) to Managed Bean parveidotajs
3) Managed Bean parveidotajs transforms entered values and sucessfully inserts data in database table Regresijas_punkti
4) PROBLEM: .jspx object af:table (based on database table Regresijas_punkt) doesn't know about this data changes in database table. So I have correct values in database and old values in af:table
*.jspx: inputText*
<af:inputText label="InputText:" id="it5"
         value="#{parveidotajs.ievade}" rows="10"
         autoSubmit="true"/>*.jspx: af:table* (automatically generated "Drop As" from View Object RegresijasPunktiView, database table Regresijas_punkti):
<af:table value="#{bindings.RegresijasPunktiView1.collectionModel}"
                        var="row"
                        rows="#{bindings.RegresijasPunktiView1.rangeSize}"
                        emptyText="#{bindings.RegresijasPunktiView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                        fetchSize="#{bindings.RegresijasPunktiView1.rangeSize}"
                        rowBandingInterval="0" id="t1" width="400">
                <af:column sortProperty="Id" sortable="false"
                           headerText="#{bindings.RegresijasPunktiView1.hints.Id.label}"
                           id="c2" width="50">
                  <af:inputText value="#{row.bindings.Id.inputValue}"
                                label="#{bindings.RegresijasPunktiView1.hints.Id.label}"
                                required="#{bindings.RegresijasPunktiView1.hints.Id.mandatory}"
                                columns="#{bindings.RegresijasPunktiView1.hints.Id.displayWidth}"
                                maximumLength="#{bindings.RegresijasPunktiView1.hints.Id.precision}"
                                shortDesc="#{bindings.RegresijasPunktiView1.hints.Id.tooltip}"
                                id="it4">
                    <f:validator binding="#{row.bindings.Id.validator}"/>
                    <af:convertNumber groupingUsed="false"
                                      pattern="#{bindings.RegresijasPunktiView1.hints.Id.format}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="Kopa" sortable="false"
                           headerText="#{bindings.RegresijasPunktiView1.hints.Kopa.label}"
                           id="c3">
                  <af:inputText value="#{row.bindings.Kopa.inputValue}"
                                label="#{bindings.RegresijasPunktiView1.hints.Kopa.label}"
                                required="#{bindings.RegresijasPunktiView1.hints.Kopa.mandatory}"
                                columns="#{bindings.RegresijasPunktiView1.hints.Kopa.displayWidth}"
                                maximumLength="#{bindings.RegresijasPunktiView1.hints.Kopa.precision}"
                                shortDesc="#{bindings.RegresijasPunktiView1.hints.Kopa.tooltip}"
                                id="it1">
                    <f:validator binding="#{row.bindings.Kopa.validator}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="X" sortable="false"
                           headerText="#{bindings.RegresijasPunktiView1.hints.X.label}"
                           id="c4" width="50">
                  <af:inputText value="#{row.bindings.X.inputValue}"
                                label="#{bindings.RegresijasPunktiView1.hints.X.label}"
                                required="#{bindings.RegresijasPunktiView1.hints.X.mandatory}"
                                columns="#{bindings.RegresijasPunktiView1.hints.X.displayWidth}"
                                maximumLength="#{bindings.RegresijasPunktiView1.hints.X.precision}"
                                shortDesc="#{bindings.RegresijasPunktiView1.hints.X.tooltip}"
                                id="it2">
                    <f:validator binding="#{row.bindings.X.validator}"/>
                    <af:convertNumber groupingUsed="false"
                                      pattern="#{bindings.RegresijasPunktiView1.hints.X.format}"/>
                  </af:inputText>
                </af:column>
                <af:column sortProperty="Y" sortable="false"
                           headerText="#{bindings.RegresijasPunktiView1.hints.Y.label}"
                           id="c1" width="50">
                  <af:inputText value="#{row.bindings.Y.inputValue}"
                                label="#{bindings.RegresijasPunktiView1.hints.Y.label}"
                                required="#{bindings.RegresijasPunktiView1.hints.Y.mandatory}"
                                columns="#{bindings.RegresijasPunktiView1.hints.Y.displayWidth}"
                                maximumLength="#{bindings.RegresijasPunktiView1.hints.Y.precision}"
                                shortDesc="#{bindings.RegresijasPunktiView1.hints.Y.tooltip}"
                                id="it3">
                    <f:validator binding="#{row.bindings.Y.validator}"/>
                    <af:convertNumber groupingUsed="false"
                                      pattern="#{bindings.RegresijasPunktiView1.hints.Y.format}"/>
                  </af:inputText>
                </af:column>
              </af:table>
parveidotajs.java (takes inputText value, transforms it and inserts in database table Regresijas_punkti):
    public void setIevade(String ievade) {
        this.ievade = ievade;
        String[] result = ievade.split("\\s");
<...> //getting double values resultX and resultY from result array;
        try {
            Connection con =
                DriverManager.getConnection("localhost", "Username", "password");
            Statement st = con.createStatement();
            st.executeUpdate("Delete from Regresijas_Punkti");
            for (int i = 0; i < resultX.length; i++) {
                st.executeUpdate("INSERT INTO Regresijas_Punkti values (" + i +
                                 ",'Punkti'," + resultX[i] + "," + resultY[i] +
            con.close();
        } catch (Exception e) {
            System.err.println("Got an exception! ");
            System.err.println(e.getMessage());
    }

Similar Messages

  • How to avoid table refresh on row selection

    Hi,
    I have a table where the row selection happens on selecting the check box in the first column of the row. The check box is bound to the transient Boolean attribute of my VO to support this functionality which is missing in new version of ADF. The selection is working fine, however I am facing the issue with table refresh. Everytime I click checkbox to select or unselect a row my whole table is getting refreshed which is very unusual for user point of view. This is my code for the checkbox column:
    <af:column sortProperty="isSelected" sortable="true"
    headerText="#{bindings.pricingObjects.hints.isSelected.label}"
    id="c4"
    inlineStyle='#{(row.isSelected)?"background-color: #E7E7E7":""};'>
    <af:selectBooleanCheckbox value="#{row.bindings.isSelected.inputValue}"
    required="#{bindings.pricingObjects.hints.isSelected.mandatory}"
    shortDesc="#{bindings.pricingObjects.hints.isSelected.tooltip}"
    id="it4" simple="true"
    autoSubmit="true">
    <f:validator binding="#{row.bindings.isSelected.validator}"/>
    </af:selectBooleanCheckbox>
    I have to keep autoSubmit="true" on selectBooleanCheckbox because the table has to change color of the row everytime the checkbox is selected or deselected. Also, there are multiple commandToolbarButton such as "Delete" which needs to be enabled/disabled depending on the row selection.
    Is there anyway, I can achieve this behaviour with minimal refresh of table?

    Hi Marge,
    Yes I do have Add and Delete toolbar button in the panelCollection and also set partialTrigger="tableId" on them. I need this partialTriggers because Delete button should enable/disable depending on number of rows added in the table. However, I tried removing them but it did not work for me, table is still refreshing. BUT this solution does work in combination of other solution i.e. removing ChangeEventPolicy="ppr" on the iterator. I need ppr because I have a form which is bound to the same iterator and should change on table selection. The design is like this,
    - Read-only Table on top
    - Editable Form below
    - Select the row in table and edit the fields in the form
    If I remove ppr then my form is not updating with the row selection.
    Regards,
    Afroz

  • ADF table refresh on update of database field in the background

    Hi,
    I have an ADF Read Only table based on Toplink mapping for a database table. In my scenario, one of the columns (Name) gets updated in the background (through DB adapter from ESB.
    The problem is the ADF table does not refresh to reflect the updated name, on navigating to other pages and coming back (basically page reload).
    The updated name does not reflect until I logout of the session.
    I have used the explicit refresh option for the "findALL" method used by the ADF table. I have also tried setting "NoIdentityMap" option in Toplink Identity Map.
    Please let me know how can I get the table refreshed. I'm using JDev 10.1.3.1 with Toplink.
    Rgds
    Vikas

    I have same problem, and I tried af:poll . It only works when I insert a new record or delete a new record. It doesn't work when I update records.
    I followed this example from Frank Nimphius
    http://thepeninsulasedge.com/frank_nimphius/2007/09/18/adf-faces-using-afpoll-to-refresh-a-table/
    Plus the selection action is not work at all. (My case is multiple selection).
    I just want to know is it possible using af:poll conponment to autorefresh ADF table when I update a record ?
    JDeveloper 10.1.3.3
    Message was edited by:
    xpp

  • How are the summary tables refreshed

    hi all,
    Can you please tell me how are the summary tables refreshed. Does the Oracle databse do it or the discoverer server performs the tasks

    Hi,
    Discoverer summary tables are stored as materialized views in the database. The database refreshes the MV depending on how the MV refresh has been set up.
    Rod West

  • Table refresh is not working in case of data fetched from OUCM

    Hi All,
    I have created a Content Repository data control for a OUCM connection in an ADF application.
    I have five methods inside that. (advancedSearch, getURI, getAttributes, getItems, search)
    I have dragged and dropped the Return inside search method, as an ADF table in a jspx page. The table displays the list of documents in OUCM.
    The table code looks as follows.
    <af:table value="#{bindings.Return.collectionModel}" var="row"
    rows="#{bindings.Return.rangeSize}"
    emptyText="#{bindings.Return.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.Return.rangeSize}"
    rowBandingInterval="0"
    disableColumnReordering="true"
    selectionListener="#{bindings.Return.collectionModel.makeCurrent}"
    rowSelection="multiple" id="t2"
    binding="#{MyDocumentBean.documentTable}"
    filterModel="#{bindings.ReturnQuery1.queryDescriptor}"
    queryListener="#{bindings.ReturnQuery1.processQuery}"
    filterVisible="true" varStatus="vs"
    immediate="true" partialTriggers="delete"
    columnStretching="column:c2" width="948"
    columnResizing="disabled"
    contentDelivery="immediate" verticalGridVisible="false"
    displayRow="selected" summary="document table">
    I have a remove button with code as follows
    <af:commandButton text="Remove" actionListener="#{MyDocumentBean.deleteDoc}" id="delete" partialSubmit="true">
         </af:commandButton>
    In the MyDocumentBean's deleteDoc method , I am connecting to OUCM using RIDC and then deleting the content from OUCM.
    I have set the partialTrigger on table on partialSubmit of the remove button. But after I remove a document, the content is deleted from OUCM, but the table that shows the list of documents is not refreshed.
    I have to manually click a refresh button to refresh the table's content . The code for refresh button is
    <af:commandButton actionListener="#{bindings.search.execute}" text="Refresh" disabled="#{!bindings.search.enabled}" id="refresh" >
         </af:commandButton>
    I even tried using the below code for the search to be executed in the deleteDoc method
         BindingContext bindingContext = BindingContext.getCurrent();
         BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
         OperationBinding operationBinding = (OperationBinding) bindings.get("search");
         operationBinding.execute();
    But it also didn't work.
    I have even tried the following in the pageDefinition file. But in vain :(
    <methodIterator Binds="search.result" DataControl="OUCMDataControl"
    RangeSize="25"
    BeanClass="OUCMDataControl.search_return"
    id="searchIterator" Refresh="always"/>
    Please let me know how to refresh the table.
    Thanks in advance,
    Harini.

    Hi,
    can you try to refresh table "deleteDoc" action listener method using the below code
    AdfFacesContext.getCurrentInstance().addPartialTarget(tableBinding);if this doesn't work you can try to refresh the whole page (dont know whether its a good practice)
                            FacesContext context = FacesContext.getCurrentInstance();
                            String currentView = context.getViewRoot().getViewId();
                            ViewHandler vh = context.getApplication().getViewHandler();
                            UIViewRoot x = vh.createView(context, currentView);
                            context.setViewRoot(x);~Abhijit

  • Form is not working after table refresh

    I've made a form and have added pre-insert trigger for the block. And the form is working perfectly fine with no issues.
    Two new columns have been added to the table and have to be added to the form now.
    I opened the data block wizard of the form and did a refresh of the table to get the two columns. After I pressed the "refresh" and then tried to run the form(but did not add new columns), the pre-insert trigger fails and starts throwing me an error that value has to be entered.(FRM:40202)
    After further analysis I also found out that there was null value being passed into another item. Actually when I refresh the Datablock wizard I can see this column on the left hand side than being present on the right hand side.
    Kindly if you could help on the same.

    Hi Vidhya
    pre-insert trigger fails and starts throwing me an error that value has to be entered.(FRM:40202)that's FRM-40202 (Field Must be entered)
    pls make sure any new db column that's defined as NOT NULL in the table that u r trying to insert in is pre-insert has an insert statment.; must have a value.
    the main issue here is ur table u r trying to insert in ; it has nothing to do with the form wizard's item on the left or the right hand side.
    Hope this helps...
    Regards,
    Abdetu...

  • Detail table refreshing without partial trigger!!!

    Hi,
    my Jdeveloper version is 11.1.2.3.0
    I have a master detail structure on my page and i have two weird behaviors (that i guess are related).
    I created the master detail tables in the classic way:
    I dragged the master data control and doped it on the page as an ADF table (id t1)
    Then i dragged the detail data control (from inside the master data control) and drop it as an ADF table (id t2).
    I verified that the partial trigger property of the detail table does not contain the id of the master table (t1).
    however (the first weird behavior), at run time, the detail table shows always the right information of the selected master row.
    How can this happen?
    The second weird behavior is that i have createInsert button (created by drag and drop of the createInsert operation of the dataControl) in the toolbar of the master table.
    If i create a new row and fill the required data then navigate to another row, the detail table is refreshed correctly and shows the details of the newly selected row, but if i go back (re-select) the newly created row the detail table does not refresh and still shows the detail of the previous master row!!! (furthermore, i have input date in this newly create row, so if, at this stage, i click on the calendar icon to open it, the calendar doesn't open)
    I'm i doing something wrong? or should i change any property of the tables?
    Thanks for your help

    Hi Timo,
    Thank you for your reply.
    Actually no, i didn't commit the new record at this point and this is the problem.
    If i commit the new record (using the commit button created from the commit operation of the module), the page refreshes and works correctly.
    The problem occurs if i change the selected row (and then re-selected the newly created row) before committing the changes.
    Concerning the auto PPR, do you think that deactivating it may help? and if yes, how can i deactivated for this page only?
    I tried to change the "change event policy" property of both the master and the detail iterator in the page binding from ppr to "non" but nothing changed. The detail table still refreshes, and the problem with newly created master row still appears.
    One adiitinal note: i downloaded the sample from Andrejus Baranovskis's Blog
    http://andrejusb-samples.blogspot.com/2009/03/jdevadf-sample-create-operation-for.html
    and the page is working correctly. I also created a jsf page in this project with master detail using the same method i used in my project and this pages also works correctly.
    So this means that the problem is with the verision of jdev no? but what what is it???
    Thank you again
    Edited by: 997720 on Apr 5, 2013 8:48 AM

  • Internal table refreshing

    Hi Experts,
       I  copyed the me2k(RM06EK00) program to Zprogram and doing some
    modification.
    My problem is I declared the internal table and some values are populating to
    the internal table in the subroute PERFORM ekpo_ausgabe(sapfm06l).
    (This is last perform statement before END-OF-Selection),
    when it comes out of the perform statement and before End-of- selection my internal table values are refreshed automatically, I didn't refreshed the internal table.
    Pls help me to get the values without refreshing my IT.
    Thanks in advance
    karthik

    For example,  lets look at program ZRICH_0001, here  I am calling a PERFORM which is in program ZRICH_0002 and then pulling that internal table out of the memory stack.
    report  zrich_0001.
    types: tt001 type table of t001.
    field-symbols: <it001> type tt001.
    data: pointer_string type string.
    data: xt001 like line of <it001>.
    start-of-selection.
    * Call the perform in other program
      perform fill_up_it001 in program zrich_0002.
    * Assign an internal table
      pointer_string = '(ZRICH_0002)IT001[]'.
      assign (pointer_string) to <it001>.
      loop at <it001> into xt001.
        write: / xt001-bukrs, xt001-butxt..
      endloop.
    And the code for the second program.
    report zrich_0002 .
    data: it001 type table of t001.
    *       FORM fill_up_it001                                            *
    form fill_up_it001.
      select * into table it001 from t001.
    endform.
    Now I think this will work for you, but the internal table from the PERFORM must be global variable in the main program, not local to the FORM, if it is local to the FORM, then this will not work.
    Regards,
    Rich Heilman

  • 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/>

  • Table Refresh not showing correct data

    Hi ,
    Jdeveloper version 11.1.2.2.0
    I am facing issue regarding data refresh on table whenever value changes in LOV. Here goes the usecase :
    Please not I m not using ViewLink ( as some constraint in my project.. this is a sample to replicate )
    LOV to select department. - AutoSubmit ( true) . Value change listener code :
    +// Add event code here...+
    +setExpressionValue("#{bindings.DepartmentsEOView1.inputValue}",+
    +valueChangeEvent.getNewValue());+
    +OperationBinding operationBinding =+
    +findOperation("setBindVarForEmployeeVO");+
    +operationBinding.execute();+
    AMImpl method which takes the deptId and executes the Employee. ( This method is the default activity of the taskflow and called whenever the value selected in Department LOV changes)
    +public Integer setBindVarForEmployeeVO(){+
    +Integer deptIdVar = new Integer(-1);+
    +DepartmentsEOViewImpl deptVO = this.getDepartmentsEOView1();+
    +if(!deptVO.isExecuted()){+
    +deptVO.executeQuery();+
    +}+
    +if(deptVO.getCurrentRowIndex()==-1){+
    +deptIdVar = (Integer)deptVO.first().getAttribute("DepartmentId");+
    +}else{+
    +deptIdVar = (Integer)deptVO.getCurrentRow().getAttribute("DepartmentId");+
    +}+
    +this.getEmployeesEOView1().setDepartmentIdVar(deptIdVar);+
    +this.getEmployeesEOView1().executeQuery();+
    +System.out.println("Salary of emp "+ this.getEmployeesEOView1().first().getAttribute("Salary"));+
    +return deptIdVar;+
    +}+
    Editable Table displaying Employees for selected department ( I have a viewCriteria in-memory applied on my VO when exposed in AM ) . Partial Trigger points to LOV .
    I did following on page and not getting expected results :
    1. For Department 340, I changed the salary of the first employee shown from 25000 to 15000.
    2. Selected another department 10 in department LOV.
    3. Reselect the department 340, and ... what I see is salary is 15000. Even though we are re-executing the VO.
    How do i know it is refresh issue :
    In my am method I am printing the salary of the first employee for a department. ... it is getting printed 25000.
    Am i missing something ..
    Sample application ... http://dl.dropbox.com/u/70986236/Question%20Posted%20on%20OTN/TestViewCriteriaMode.zip
    Thanks,
    Rajdeep
    Edited by: Rajdeep on Aug 7, 2012 5:51 PM
    Edited by: Rajdeep on Aug 8, 2012 2:18 AM

    thats wht i am saying.. if you are using an inputText then the refreshed values will not be shown immediately.. it needs an externa laprtial refresh.. ok do one thing. change the salary value in the UI to outputText and see if the value is refreshing or not. if it refreshes then the issue is with the inputText refresh.. otherwise we have to investigate further.. by the way the app that you gave.. was giving some bc4j error.. for which i need time to investigate.. will look into it later..

  • Issue in ADF Table Refresh

    Hi All,
    I have a requirement where I need to change the timezone and display the dates in a Table. There is a dropdown above table and as the user changes the
    timezone value ,the dates changes accordingly in the Table.
    The following steps are followed to achieve this:
    1) The following attributes are present in the DB object on which the EO(TaskTableEO) is based :
    - TASK_ID
    - TASK_NAME
    - TASK_NUMBER
    - TASK_OWNER
    - END_DATE
    - START_DATE
    - SUMMARY
    2) VO Query :
    SELECT TaskTableEO.TASK_ID,
    TaskTableEO.TASK_NAME,
    TaskTableEO.TASK_NUMBER,
    TaskTableEO.TASK_OWNER,
    test_util.convert_timezone(TaskTableEO.END_DATE,:timezone1) END_DATE,
    csf_util_pvt.convert_task_table_timezone(TaskTableEO.START_DATE,:timezone2) START_DATE,
         TaskTableEO.SUMMARY
    FROM TASK_TABLE TaskTableEO
    Note that the timezones are converted in the VO based on the bind parameter passed to the function test_util.convert_timezone. The function returns the date converted to
    the timezone specified.
    When the value is changed in the dropdown , the value change listener is called. The timezone selected is picked, the bind variables is set , executeQuery()
    is called on the VO , and the table is refreshed . But the date does not show the change in Timezone , but instead it take the default from database.
    Can you please suggest if am missing something. Also let us know if we can achieve this using some alternate method.
         Sample Code in Managed Bean:
    BindingContext bindingctx = BindingContext.getCurrent();
    oracle.binding.BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("TaskVO1Iterator");
    ViewObject vo =dciter.getViewObject();
    vo.setNamedWhereClauseParam("timezone1",tzId);
    vo.setNamedWhereClauseParam("timezone2",tzId);
         vo.executeQuery();
         RichPanelCollection rpc = (RichPanelCollection)ADFUtil.findComponentInRoot("taskPc");
    System.out.println("RichPanelCollection : " + rpc);
    AdfFacesContext adfCtx = AdfFacesContext.getCurrentInstance();
    adfCtx.addPartialTarget(rpc);

    Why not using declaratively dropdown to partialTrigger in table?
    However, instead of panelcollection, try refreshing table instance in code.

  • Keep selection on table refresh

    Hi,
    I have a selectOneChoice table based upon a view. I'm trying to update the DB values for the selected row in the background (i.e. change of column value or so) and then want to refresh the table with keeping the row selected.
    It works, when I have no selection state assigned to the table as table property (selectionState="#{bindings.MyView1.collectionModel.selectedRow}"). But then there is initially no row (i.e. the first row) selected - that's bad too!
    Is there any way to refresh a single row in a table or to keep somehow the selected one during refresh?
    Thank you very much!
    Sebastian

    Frantz,
    Sure you can.
    1. Set "selection cardinality" of corresponding node to 0..1 or 0..n rather 1..1 or 1..n
    2. Set "initialize lead selection" of corresponding node to false.
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • VC table refresh w/ RFCs not stored procedures

    I've got a complex model, but I'll separate out just a piece that represents what I want to do..I'll try to describe it. This particular example is for a list of approvers.
    main model-> select "approvers" tool bar button->pop up iview that contains: start pt->RFC to get existing data from R/3 -> table view allowing user to add/edit/save/get defaults
    Save button->RFC to save data->end pt->return to main model.
    add or Edit button-> popup iview to form to input details w/ insert button to return entry to table view.
    Get Defaults button -> popup iview to call RFC to read list of default approvers from r/3 and return all of them to table view.
    The table will not refresh with the all of data returned from either popup iview. I have to save the data, sight unseen, return to the application and re-enter the approval iview before the table shows all of the data.
    Here are the issues.
    1. I've read the blogs and threads on the refresh button (which I tried, but since the records from the default and edit events hadn't been saved at that point, didn't work because they weren't in the database to be re-read.). I've also read about the timer, but can't figure out how to implement since (pulling from thread 3105110), it says use a timer as the start point of a table view...and I don't have anyway to have a start point of the table view since it is populated by the RFC that reads the database and the added/edited data is only in "memory" at this point. 
    2. The pop-up iview to return defaults will only return one record at a time. Even with the mapping set to all data rows and multiple selection allowed. Is there a way to just return all rows?
    Can anyone point me in the right direction? My training is limited to reading here and the book SAP NetWeaver Visual Composer.

    Hi
    Instead of passing the data to the forms or tables by directly connecting them to the data sources, try and use signal out and signal in, if a table gets data from either of 2 sources then each source should have a signal out with the same name and the signal in should have the same name.
    Jarrod Williams

  • Oracle Coherence database sync while table refresh

    Hello,
    I am using Oracle Coherence to cache a database table for read only puposes. However, my question is that this table needs to be fully refreshed every night and during this time I want to retain the cache in Oracle Coherence and do not want it to be recycled as well since it has to be available 24X7. Is there a way to do that? I am thinking of using a custom CacheStore class that will have its own local cache of the table or the other approach will be to look up in the shadow table while the primary table is being refreshed? Are there any other optimum ways to do this? The primary consideration for me is fast response.
    Any help will be appreciated.
    Thanks,
    Jay

    Hi Jay,
    No, I am not suggesting to stop or start the JVMs. Everything will continue run as it was running ...
    The Nightly refresh process that loads the data will load in non-active version of the cache (dataCache). Once the load is completed, it will update the MarkerCache (markerCache) with this version. All the client requests will follow something like this:
    //Lookup in markerCache which version of the data cache is active
    NamedCache markerCache=CacheFactory.getCache("markerCache");
    String str=markerCache.get("dataCacheName");
    //The cache which has the refreshed and updated data (dataCachev1 or dataCachev2)
    NamedCache dataCache=CacheFactory.getCache(str);
    For the nightly refresh process, you will do something like this:
    NamedCache markerCache=CacheFactory.getCache("markerCache");
    String str=markerCache.get("dataCacheName");
    if ("dataCachev1".equals(str)){
           NamedCache newDataCache=CacheFactory.getCache("dataCachev2");
           //load the data{ }
           //update the marker Cache with this newly loaded cache; from now on the client will start using this newly loaded cache
           markerCache.get("dataCacheName","dataCachev2");
           // wait for few minutes to let all the old request complete
           //destroy the old cache
           CacheFactory.getCache("dataCachev1").destroy();
    } else{
        //do the reverse for dataCachev1 and dataCachev2
    }The only thing you need to note is that there might still be some requests using the dataCachev1 when it is destroyed so you need to handle the exception gracefully at the client application.
    Please note, that you should optimize the code to minimize the time spent in lookup of the markerCache by using Maplisteners as appropriate.
    Hope this helps!
    Cheers,
    NJ

  • Table refresh Using Network Link

    Hi All,
    I am using 11g 11.1.0.6 database and I am usning network link to refresh few tables. The requirement is something like , on production , we have META schema
    and on Test we have meta_qa schema. meta on prod has five tables , for example tab1... tab5. now, i need to refresh these tables in meta_qa on test.
    we are also using one job , which is doing the same thing , but here the only difference is , we don't have meta_qa schema on prod database.
    regards

    Thanks Justin for the inputs, but I still not out of the woods.
    userid=x/x
    TABLES=(USER_SECURITY_INBOX,USER_ACCESS_SECURITY,WH_USERS_OPID,WH_USERS_OPID_INFO,WH_USERS_REDBRICK_INFO)
    EXCLUDE=CONSTRAINT
    table_exists_action=truncate
    remap_schema=META:META_QA
    NETWORK_LINK=CPMPROD
    LOGFILE=data_pump_dir:meta_reload_imp.log
    content=DATA_ONLY
    JOB_NAME=RELOADAnd the log file returns following ----
    Import: Release 11.1.0.6.0 - 64bit Production on Friday, 30 March, 2012 15:20:05
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning and OLAP options
    Starting "ORAADMIN"."RELOAD":  PARFILE=/db/cpmtest/oracle/scripts/imp/ctl/cpmtest_meta_qa_reload_dp_imp.ctl
    Estimate in progress using BLOCKS method...
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    ORA-39166: Object WH_USERS_REDBRICK_INFO was not found.
    ORA-39166: Object WH_USERS_OPID_INFO was not found.
    ORA-39166: Object WH_USERS_OPID was not found.
    ORA-39166: Object USER_ACCESS_SECURITY was not found.
    ORA-39166: Object USER_SECURITY_INBOX was not found.
    ORA-31655: no data or metadata objects selected for job
    Job "ORAADMIN"."RELOAD" completed with 6 error(s) at 15:20:12

Maybe you are looking for