Adding Rows Dynamically using AbstractTableModel

I would do anything for some help on this one. I have a JTable that has 5 rows within 1 column. After the user gets to the 5th row I want them another row to be added so that they could add informatoin in there. When I do this with the following code below nothing happens and my column count ends up being -1 right after I do this. If anyone could help it this would be a great help. The output in my console when I end up putting information into all the rows up to the 4th one is the following.
Vector size 0
column count1
column count1
row 0column 0
row 1column 0
row 2column 0
row 3column 0
row 4column 0
column count1
row 4column -1
/*********This is my AbstractTableModel Class *********/
package com.ibm.esup.agent.dataqmonitor;
* @author garbersb
* This class sets up the Table Model for the Message Input Queue.
import java.util.*;
import javax.swing.table.*;
import javax.swing.*;
public class QueueTableModel extends DefaultTableModel
     /** Vector where the message information will be kept. */
     Vector data = null;
     /** Number of columns within the input queue table. */
     protected static int NUM_COLUMNS = 1;
     /** Number of rows within the input queue table. */
     protected static int START_NUM_ROWS = 5;
     /** Next row that could be empty. */
     protected int nextEmptyRow = 0;
     /** Number of rows we are at. */
     protected int numRows = 0;
     * @see java.lang.Object#Object()
     * This will end up creating a Vector when this gets created.
     public QueueTableModel()
          data = new Vector();
          System.out.println("Vector size " + data.size());
     * @see javax.swing.table.TableModel#getColumnName(int)
     * This will allow us to get the Column Name.
     public String getColumnName(int column)
          switch (column)
          return "";
     * @see javax.swing.table.TableModel#getColumnCount()
     public synchronized int getColumnCount()
          System.out.println("column count" + NUM_COLUMNS);
          return NUM_COLUMNS;
     * @see javax.swing.table.TableModel#getRowCount()
     public synchronized int getRowCount()
          if (numRows < START_NUM_ROWS)
               return START_NUM_ROWS;
          else
               return numRows;
     * @see javax.swing.table.TableModel#getValueAt(int, int)
     public synchronized Object getValueAt(int row, int column)
          try
               String queue = (String) data.elementAt(row);
               switch (column)
                    case 0 :
                         return queue;
          catch (Exception e)
          return "";
     * Don't need to implement this method unless your table's
     * editable.
     public boolean isCellEditable(int row, int col)
          return true;
     * Don't need to implement this method unless your table's
     * data can change.
     public void setValueAt(Object value, int row, int col)
          String queueValue = (String) value;
          data.addElement(queueValue);
          fireTableCellUpdated(row, col);
     * * inserts a row at the end of the table model */
     /*public void insertRow(){      
          int length = getRowCount();
          for (int i=0; i<length ; i++)
          //just add blank string values in this instance but your
          //code will initialise a default object no doubt
          data.addElement("");
          //baseData is the vector containing all your row vectors
          fireTableDataChanged();
     public void addRow()
          addRow(data);
          fireTableDataChanged();
     * Method updateQueue.
     * This method will allow us to update the queues with the latest
     * and greatest information of what messages got added or are
     * on the queue and what time the messages occurred.
     * @param monitorMsgObject
     public synchronized void updateQueue(MonitorMessageObject monitorMsgObject)
     public static void main(String[] args)
/*********** THis is my main gui class that will has a TableListener and ActionHandler inner - classes within *************/
package com.ibm.esup.agent.dataqmonitor;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.*;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400Exception;
import com.ibm.as400.access.AS400SecurityException;
* @author garbersb *
* This will allow the user to sign onto a particular system
* with a valid user id and password.
public class SignOn extends JFrame
     /** Label for the system name. */
     private JLabel labelSystemName;
     /** Label for the user name. */
     private JLabel labelUserName;
     /** Label for the password. */
     private JLabel labelPassword;
     /** Label for input queue. */
     private JLabel labelInputQueue;
     /** Label for output queue. */
     private JLabel labelOutputQueue;
     /** Text Field for the system name. */
     private JTextField textFieldSystemName;
     /** Text Field for the user name. */
     private JTextField textFieldUserName;
     /** Text Field for the password. */
     private JPasswordField textFieldPassword;
     /** Text Field for the input queue. */
     private JTextField textFieldInputQueue;
     /** Text Field for the output queue. */
     private JTextField textFieldOutputQueue;
     /** Button that will allow the user to submit. */
     private JButton buttonSubmit;
     /** String that will be used for the system name,
     * user name and password. */
     private String systemName, userName, password, inputQueue, outputQueue;
     /** Label for the input table where different queues
     * can be entered. */
     private JLabel labelQueueInput = null;
     /** One Column table where users can enter different
     * queues that they want to view. */
     private JTable tableQueueInput = null;
     /** Scroll pane that will be used to put the
     * table inside of it. */
     private JScrollPane scrollPaneQueueInput = null;
     /** Label for the interval time that they want to
     * check these different queues. */
     private JLabel labelIntervalCheck = null;
     /** Table panel */
     private JPanel panelTable = null;
     /** Text Field where users can enter a number
     * that will end up being the time that this application
     * will check thes queues. (This is in milli-seconds)
     * For example if a user wants to check the queue every 5 minutes
     * they would enter 60000 within this text field. */
     private JTextField textFieldIntveralCheck = null;
     /** Table Model Input Queue */
     private QueueTableModel tableModelInputQueue = null;
     /** AS400 system object that will be used to sign
     * onto an iSeries system. */
     private AS400 system;
     * Method loadGui.
     * This will load the Sign On Frame and will allow the
     * user to enter the information within the Text Field
     * or specify an xml file that has TCP information already
     * in it.
     public void loadGui()
          //Set the Title
          this.setTitle("Sign On to iSeries System");
          Container contentPane = this.getContentPane();
          GridBagLayout gbl = new GridBagLayout();
          GridBagConstraints gbc = new GridBagConstraints();
          gbc.insets = new Insets(10, 10, 10, 10);
          gbc.fill = GridBagConstraints.EAST;
          contentPane.setLayout(gbl);
          labelSystemName = new JLabel("System Name");
          gbc.gridx = 0;
          gbc.gridy = 1;
          gbl.setConstraints(labelSystemName, gbc);
          contentPane.add(labelSystemName);
          textFieldSystemName = new JTextField();
          textFieldSystemName.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 1;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldSystemName, gbc);
          contentPane.add(textFieldSystemName);
          labelUserName = new JLabel("User Name");
          gbc.gridx = 0;
          gbc.gridy = 2;
          gbl.setConstraints(labelUserName, gbc);
          contentPane.add(labelUserName);
          textFieldUserName = new JTextField();
          textFieldUserName.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 2;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldUserName, gbc);
          contentPane.add(textFieldUserName);
          labelPassword = new JLabel("Password");
          gbc.gridx = 0;
          gbc.gridy = 3;
          gbl.setConstraints(labelPassword, gbc);
          contentPane.add(labelPassword);
          textFieldPassword = new JPasswordField();
          textFieldPassword.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 3;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldPassword, gbc);
          contentPane.add(textFieldPassword);
/*          labelInputQueue = new JLabel("Interval Check");
          gbc.gridx = 0;
          gbc.gridy = 4;
          gbl.setConstraints(labelInputQueue, gbc);
          contentPane.add(labelInputQueue);
          textFieldInputQueue = new JTextField();
          textFieldInputQueue.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 4;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldInputQueue, gbc);
          contentPane.add(textFieldInputQueue);
          labelInputQueue = new JLabel("Input Queue");
          gbc.gridx = 0;
          gbc.gridy = 4;
          gbl.setConstraints(labelInputQueue, gbc);
          contentPane.add(labelInputQueue);
          textFieldInputQueue = new JTextField();
          textFieldInputQueue.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 4;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldInputQueue, gbc);
          contentPane.add(textFieldInputQueue);
          labelOutputQueue = new JLabel("Output Queue");
          gbc.gridx = 0;
          gbc.gridy = 5;
          gbl.setConstraints(labelOutputQueue, gbc);
          contentPane.add(labelOutputQueue);
          textFieldOutputQueue = new JTextField();
          textFieldOutputQueue.setColumns(20);
          gbc.gridx = 1;
          gbc.gridy = 5;
          gbc.gridwidth = 4;
          gbl.setConstraints(textFieldOutputQueue, gbc);
          contentPane.add(textFieldOutputQueue);
          labelQueueInput = new JLabel("Input Queues");
          gbc.gridx = 0;
          gbc.gridy = 6;
          gbl.setConstraints(labelQueueInput, gbc);
          contentPane.add(labelQueueInput);
          tableQueueInput= new JTable();
          scrollPaneQueueInput = new JScrollPane(tableQueueInput);
          Dimension tableQueueInputDimension = new Dimension(220, 100);
          scrollPaneQueueInput.setPreferredSize(tableQueueInputDimension);
          gbc.gridx = 1;
          gbc.gridy = 6;
          gbc.gridwidth = 4;
          gbl.setConstraints(scrollPaneQueueInput, gbc);
          contentPane.add(scrollPaneQueueInput);
          //Setting up the table model input queue.
          tableModelInputQueue = new QueueTableModel();
          tableQueueInput.setModel(tableModelInputQueue);
          TableListener tableListener = new TableListener();
          tableModelInputQueue.addTableModelListener(tableListener);          
          buttonSubmit = new JButton("Submit");
          gbc.gridx = 0;
          gbc.gridy = 7;
          gbl.setConstraints(buttonSubmit, gbc);
          contentPane.add(buttonSubmit);
          RunHandler handler = new RunHandler();
          buttonSubmit.addActionListener(handler);
          //For now we will set the text in the
          //input and output queue for the Analyzer
          //Agent.
          textFieldInputQueue.setText("/qsys.lib/qesp.lib/anz_input.dtaq");
          textFieldOutputQueue.setText("/qsys.lib/qesp.lib/anz_output.dtaq");
     private class TableListener implements TableModelListener {
public TableListener() {
public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int column = e.getColumn();
String columnName = tableModelInputQueue.getColumnName(column);
Object data = tableModelInputQueue.getValueAt(row, column);
System.out.println("row " + row + "column " + column);
if (row == 4) {
     tableModelInputQueue.addRow();
          * @author garbersb
          * This will end up creating the System object
     * by getting the system name, user id and
     * password from the Text Field values.
     private class RunHandler implements ActionListener
          * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
          * When the submit button is selected it will cause the
          * action event to do something.
          public void actionPerformed(ActionEvent e)
               if (e.getSource() == buttonSubmit)
                    //here we will get the system name, user name
                    //and password.
                    systemName = textFieldSystemName.getText().trim();
                    userName = textFieldUserName.getText().trim();
                    char[] passwordCharArray = textFieldPassword.getPassword();
                    String password = new String(passwordCharArray);
                    inputQueue = textFieldInputQueue.getText().trim();
                    outputQueue = textFieldOutputQueue.getText().trim();
                    //here we will create an AS400 Object.
                    try {
                         system = new AS400(systemName, userName, password);
                         system.connectService(AS400.SIGNON);
                    catch (AS400SecurityException as400e) {
                         as400e.toString();
                    catch (IOException ioe) {
                         ioe.toString();
                    //Going to hide the Sign On window now.
                    setVisible(false);
                    //Now we will load the class that monitors
                    //the input and output queues.
                    MonitorDataQueueGui monitorGui = new MonitorDataQueueGui(system, inputQueue, outputQueue);
                    monitorGui.addGui();
                    monitorGui.show();
                    monitorGui.pack();
     public static void main(String[] args)
          SignOn signOn = new SignOn();
          signOn.loadGui();
          signOn.setSize(400, 400);
          signOn.show();
          signOn.pack();
          signOn.setVisible(true);
          signOn.addWindowListener(new WindowAdapter()
               public void windowClosing(WindowEvent e)
                    System.exit(0);
}

Well....I ended up using insertRow with the following code within the method.
     public void insertRow(){      
          numRows += 1;
          fireTableDataChanged();
I changed my method for the getRowCount to the following;
     * @see javax.swing.table.TableModel#getRowCount()
     public synchronized int getRowCount()
          if (numRows < START_NUM_ROWS)
               numRows = START_NUM_ROWS;
               return START_NUM_ROWS;
          else
               return numRows;
Since I am not scared of deleting rows I think this is fine....After I did this within my SignOn class I have the following within my TableListener inner class.
     private class TableListener implements TableModelListener {
public TableListener() {
public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int column = e.getColumn();
String columnName = tableModelInputQueue.getColumnName(column);
Object data = tableModelInputQueue.getValueAt(row, column);
System.out.println("row " + row + "column " + column);
if (row > 4) {
     tableModelInputQueue.insertRow();
I am wondering if this is the best way to do it. It seems to work now without a problem but like I said...I am wondering if this is the best thing to do. Any advise would be greatly appreciated and I really do appreciate the advise that has already been given to me.

Similar Messages

  • Reading the Data from dynamically added rows of a table...

    Hi,
                  I am using adobe interactive form (WD ABAP) in which i am adding the table rows dynamically (using Jscript code).  I have to fech these data into an internal table. But I can read only the first row data..
                  Also While adding rows dynamically the same data is repeating for the consecutive rows..
                  I have found many similar posts in sdn, but i cannot get the solution. They have mentioned about adding in WDDOINIT method. Can anyone explain me what should be done,..?
    1) How to solve repeatative data while adding rows..?
    2) How to read dynamically added row data during runtime into internal table..?
    Thanks,
    Surya.

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • Add null rows in WDDOINIT  for fetching data from dynamically added rows..

    Hi,,
    I have to fetch data from a dynamically added rows of a table.
    I have followed / gone through many forums but they ddnot mention how to add null rows in the initialization method..
    I am using WD Abap..
    Can anyone help how to bind null rows in WDDOINIT method..?
    Thanks,
    Surya

    Discussed @ SDN lot of time before. Have a look at any of below threads:-
    Dynamic table in interactive form...
    Make dynamic tables in Adobe Interactive forms
    Adding Rows dynamically upon clicking the button
    How to get values to WebDynpro ABAP from dynamic table?
    Chintan

  • Adding rows in web dynpro ABAP Dynamic Interactive form.

    Hi Experts,
              I am having problem in web dynpro ABAP Dynamic Interactive form.
    This is my scenario....
    I have a dynamic interactive form that has buttons to add and remove rows in a table. It works fine when I preview it , but when I render, view or save it using ADS, it no longer works. The "add" button actually does instantiate more repeating rows, because I put some trace messages in to count them, but the added rows are not displayed. How do I make them visible?
    In web dynpro java we write some coding in modify view to set the pdf form as dynamic
    IWDInteractiveForm iForm =
    (IWDInteractiveForm)view.getElement("<ID>");
    iForm.setDynamicPDF(true);
    simillarly what we need to write in web dynpro ABAP.
    Please give me solution for the same.
    Thanks,
    Sathish

    hi all,
             expecting reply from u all. pls help me and give some sugesstion.
    regards,
    vinoth.

  • Interactive form in WD4A - dynamic table - adding rows

    Hi,
    I have a problem with dynamic table in WD4A. User can add row to table by clicking a button on form, but added rows are not transfered to mapped context node in my web dynpro application. I have made a lot of searches on SDN and I have found a lots of threads, but no answer.
    Maybe this should be a way:
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] - Read adobe data manually and create context element manualy too.. But I think this should be a part of webdynpro/interactive forms framework.
    Thanks for any answer!

    Hi, many thanks for your answer, so what do you think is the best solution for adding rows by user to interactive form's dynamic table?
    Manually read xml data during submit by this way: https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] ?
    Or is there better solution for this? (any link to some examples, blogs, etc...)
    Many thanks for any answer!

  • Dynamic datatable:adding rows

    I am working with Dynamic datatable . whilke adding a row i am able to add only one row . later i am unable to a dd .
    code:
    <h:commandLink value="ADD" action="#{icdMBean.actionAddrow}" />
    back bean:
    public void actionAddrow() {
    // Create new items.
    icdList= new ArrayList<Icd>();
    Icd myNewDataItem = new Icd();System.out.println("i am in action add row2");
    myNewDataItem.setId("new");
    icdList.add(myNewDataItem);
    if i set the id value( myNewDataItem.setId("new");) only i am able to add only one row .
    could you please suggest a solution for it.

    Hi, many thanks for your answer, so what do you think is the best solution for adding rows by user to interactive form's dynamic table?
    Manually read xml data during submit by this way: https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9121. [original link is broken] [original link is broken] [original link is broken] ?
    Or is there better solution for this? (any link to some examples, blogs, etc...)
    Many thanks for any answer!

  • Transferring data from one table to another table using a Keycolumn using SSIS row by row dynamically

    Hi All,
    I have a Store Procedure(SP) which has a output variable name "AcivityID" which is the key column. In this SP, transformation  of data is done from one table to insert data into other table. I have to execute the SP and insert row by row data
    using the output variable "ActivityID"  whose value will keep on changing. How can I do it?
    Thanks,
    Kallu

    Value changing on a row by row basis? Not quite sure what you mean, but it seems that you want to use the results of an insert into one table as input for another. If so then SSIS is not needed, inside the stored proc use the SQL that will do that and for
    all records as
    INSERT A INTO dbo.table1
    OUTPUT INSERTED.A INTO MyTable;
    Arthur My Blog

  • Adding Rows and Columns to a table depending requirements

    Hi all,
    I have created a table with one row and 2 columns of a table. My client requested adding form one to 3 columns of the right table and rows as well, depending business requirements.
    I can add coding add columns on the right, but I cannot add rows because the columns dynamic.
    I tried to write the coding for adding rows but it is not successful.  Please help.
    event : click - add colum button
    for (var i = 0; i < form1.page1.Table1._Row1.count; i++){
    var newrow = form1.page1.Table1.resolveNode("Row1[" + i + "]");
    var newrow2 = form1.page1.Table1.resolveNode("HeaderRow[" + i + "]");
    newrow._Col3D.addInstance(0);
    newrow2._Col3D.addInstance(0);
    i also published my file for your reviewing.
    https://workspaces.acrobat.com/?d=xcgcfby89J-IHenn-8xeaQ
    Thank you very much,
    Cindy

    When you are adding instances it uses the default properties of the object...
    If its hidden as a default value in the form and you add an instance, the new instance will be hidden..
    So if you have 3 columns in your default row and trying to add an instance withthe 5 columns it will only add a row with 3 columns..
    If you want to add the columns to the table, you must add the column to each new row instance.
    E.g.:
    var intCount = xfa.resolveNode("page1.table1.Row1").instanceManager.count;
    form1.page1.table1._Row1.addInstance(1);
    xfa.resolveNode("page1.table1.Row1[" + intCount.toString() + "].Col3D").addInstance(1);

  • Javascript error while creating rows dynamically (IE)

    hi all,
    as per the requirement i am creating rows dynamically by createElement() method ...
    when i load the page method where i am creating the rows is called on onLoad ... bring the data required .. some method code like this ...
    function createRows()
    var myTable = document.getElementById("itemTable");
              var tBody = myTable.getElementsByTagName('tbody')[0];
              alert(tBody);
              var td;
              var classVar;
              var browser = navigator.appName;
              if(browser=="Microsoft Internet Explorer")
                   classVar = "className";
              }else{
                   classVar = "class";
              <%
              Set keyset = checklistItems.keySet();
              Iterator keySetIterator = keyset.iterator();
              while(keySetIterator.hasNext())
                   String checklistType = (String)keySetIterator.next();
                   %>
                   if ((type == "Show_All") || (type == '<%=checklistType%>'))
                                  var newTypeTR = document.createElement('tr');
                                  var newTypeTD = document.createElement('td');
                                  newTypeTD.setAttribute("width","100%");
                                  newTypeTD.setAttribute(classVar,"font_black_s_bold");
                                  if(browser=="Microsoft Internet Explorer")
                                       newTypeTD.innerText = '<%= checklistType %>';
                                  else
                                       newTypeTD.innerHTML = '<%= checklistType %>';
                                  newTypeTR.appendChild (newTypeTD);
                                  newTypeTR.setAttribute(classVar,"td5");
                                  tBody.appendChild (newTypeTR);
    table is defined in jsp like
    <table width="727" cellSpacing="0">
                   <tr>
                        <td>
                             <div id="checklist_item_div">
                                  <table border="0" id='itemTable' width="100%" cellPadding="4" cellSpacing="0">     
                                  <tbody>
                                       <tr>
                                       </tr>     
                                  </tbody>
                                  </table>
                             </div>
                        </td>
                   </tr>
    </table>
    Now i have a combo box on my page , where onchange i am bringing new data using ajax to fill ....
    and now i want to flush all the rows i created earlier ...and again call the same method as above to create the rors and cols dynamically ...
    so after ajax call my script code to flush all rows and cols like
    var browser=navigator.appName;
                        if(browser=="Microsoft Internet Explorer")
                             itmTable.innerText = "<tbody></tbody>";
                        else
                             itmTable.innerHTML = "<tbody> </tbody>";
    but when i call the createRows function after this , i got the error on the line
    tBody.appendChild (newTypeTR);
    as tBody now getting as undefined .... this problem is with IE (working on IE 7.0)
    works very fine on firefox and safari browsers ...
    please helm me out ...
    Edited by: prashant-kadam on Jun 12, 2008 5:22 AM

    what does this have to do with Java?
    hint: Java != Javascript

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • Numbers missing reference after adding rows

    Hi,
    I came into a strange situation (which I did not have before).
    I have a sheet summary contaning formulas that uses cells from a different sheet. The source sheet contains more than 100 rows containing different numbers which are used in more than 50 formulas in the summary sheet.
    When adding rows inbetween the existing data sheet rows, I see that the summary sheet furmulas, in some cases, do not reference to the correct row number (they all should shift to the new row number) any more (out of 50 references only four got currapted).
    Any ideas are appriciated (is this a known bug).
    Thanks,
    Ziv

    Ziv,
    First, I want to thank you for asking a question that got me thinking about something I hadn't really considered before.
    I am not entirely sure I understand your question or the test you proposed in the second post, but if I am reading it correctly, what you are expecting is the way Numbers is designed to work (and the way I have seen it work) and when I try the test from your second post I get the results I expect.
    That is, a cell reference points to a cell, not a location; if you move that cell (for example, by adding a row above it, which moves it down one row) the reference in the formula is updated to reflect the new location, but the result of the calculation doesn't change.
    But this got me wondering about how Numbers dealt with references to ranges of cells. For example, the formula =SUM(C3:C6) is equivalent to =SUM(C3, C4, C5, C6), but what happens when you add a row after row 4? Apparently, the second expression remains a sum of the values in four cells, but the values of C5 and C6 are changed to reflect the fact that they have moved to C6 and C7. However, in the first expression, the new cell is added to the range, so that it is now the sum of five values. Actually, if you add a row (or column) to one that passes through a range, in the middle, or on the outside, the formula updates to add the new cell to the range, even if you are adding cells immediately below the bottom row in the range (so none of the cells in the original range actually move).
    I'm not sure any of this has much to do with your problem, unless possibly one (or four) of your expressions is referring to a range that happens to be one cell, which would update differently from one referencing a simple cell. As Jerry has said, it's pretty hard to know anything without knowing what expressions your formulas are using.
    At any rate, thanks for making me think about something I hadn't explored before.

  • Numbers 09 continuing formulas when adding rows

    Numbers 09 - I have a checkbook template but when adding rows at the bottom the formulas do not continue. I have tried adding rows from the last row "Add row below" and also while in the last cell hitting return. Neither of these work. Any suggestions?

    Hi jc,
    The rule is quite explicit: "If all the body cells in a column above the new row contain the same formula or cell
    control, the formula or cell control is repeated in the new row."
    So far there's been some information necessary to solving the problem missing from your posts. Please do the following, and supply the requested information:
    Unhide ALL rows. There are two ways to do this, depending on what was done to hid them.
    a. Click on the Reorganize button. If the checkbox beside "Show rows that match..." is checked, uncheck it.
    b. If the checkbox is unchecked, or if there are still rows hidden after unchecking it, go to the Table menu and choose Unhide all Rows.
    Click on any cell on the table to activate the table and show the Column and Row reference tabs. Hover the mouse over the tab for Row 1, then click the triangle that appears to open the local row menu. Repeat with rows 2, 3, 4, 5 and 6 until you find the first row whose menu starts with the item shown below. Which row has this menu item on your table?:
    Now click on cell G2 (the first cell containing a balance).
    Select and Copy the whole formula from this cell. Paste it into your reply to this message.
    Repeat step 3 with the formula from cell G3. Paste it directly below the formula from G2, using the example below as a guide:
    G2: (paste formula)
    G3: (paste formula)
    Regards,
    Barry

  • Problem in adding rows in a table

    Hello All ,
    I am having a strange problem in adding table rows here . All things seems to be in place . But when i click the button nothing happens . I have worked on much more complex tables and added rows safely but i cant understand what's happening here . I have saved the form as Dynamic XML form , interactive form , I have set the pagination of the repeating rows . But Heck !!! It's not working at all . I am totally confused . More over while i drag the table from the object palette an error appears and LC closes down .But when i click on the table at the toolbar and inserted table over there then it shows no error . What's happening ?? Any help is greatly appreciated .
    Script : form1.Page1.Subform1.Button1::click - (JavaScript, client)
    form1.Page1.Subform1.Table1.Row4.instanceManager.addInstance(1);
    Thanks .
    Bibhu.

    Hi,
    The way you described reminded me of another thread, where the index was not straightforward: Saving finished Form duplicates some subForms
    You can post your form to Acrobat.com, hit the Share and Publish buttons when prompted and then copy / paste the link here.
    Niall

  • How to make added row visible in atable

    hi
    i have atable with visible rowcount=5 when i click on add button anew row is added to table,that added row isby default not visible it is below 5 th row, what i want is, as soon as user clicks on add row, 6th row seen in place of 5th row,similarly 5th in place of 4th...............2nd row instead of 1st.can u please explain code for this scenario.
    thanks
    kishore

    Hi,
    You can use the following function to swap the elements
    wdContext.nodeOrders().swapElements(index1, index2)
    Ex: Swap node 5 to 4
    wdContext.nodeOrders().swapElements(5, 4);
    Or else while creating element use
    Following one will always add the element at 5th location
    IWDNodeElement element = wdContext.nodeOrders().createElement();
           wdContext.nodeOrders().addElement(5, element);
    Regards
    Ayyapparaj

  • Add row dynamically in the table.

    Please suggest me javascript function to add row dynamicly in the table whenever i click the add button..........
    thanks...........

    Put a "delete row" button to your repeating subform and use the following script on the click event:<br />form1.page1.<repeating_subform>.instanceManager.removeInstance(this.parent.index);<br /><br />Oguz<br />www.kgc.com.tr

Maybe you are looking for

  • Data recovery of trashed files

    I recently lost some data on a Hard Drive by inadvertently tossing a folder in a the trash and emptying it. ( there is no software for carelessness). My back up software just mirrored the affected drive and erased the data from the back up drive. I h

  • Ni teststand 3.5 numeric limits properties

    Hello! I have a test step with the numerical limits -0.3 and 0.5. Sometimes the DMM 4 wires measures 0.50007 for example and the test result is FAIL.I don't need this precision. I want to take into consideration only 2 digits after the comma, in orde

  • How can I make a mouseover function in iTunes

    how do I make a mouseover function in iTunes Best regards Finn [email protected]

  • I have a HP pavilion dv2117tx notebook and my display isn't working.

    Hi  I have a HP dv2117tx notebook and my display isn't working. The computer swithes on fine but the display isn't working at all. The display started experiencing problems a few months ago with intermitent lines on the screen. The frequency of the l

  • Error 4315 and 4305

    So whats nect please help LowerFilters: PxHelp20 (2.0.0.0), ASAPIW2k (6.0.0.1), UpperFilters: GEARAspiWDM (2.0.6.0), Video Driver: RADEON X300 Series\RADEON X300 Series IDE\DiskHDS722525VLSA80_______________________V36OA6HA, Bus Type ATA, Bus Address