How do i dynamically add data to a JTabel?

Hey
How do i add the data to a JTabel dynamically from a HashMap?
I tried the following:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package test;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Set;
import javax.swing.JTable;
* @author Jesper
public class Players {
    HashMap<String, Stats> players;
    public Players(){
        players = new HashMap<String, Stats>();
        addPlayer();
    public void addPlayer(){
        players.put("Martin ?rnskov", new Stats(19, 3, 1));
        players.put("Thomas Raun", new Stats(23, 6, 0));
        players.put("Jimmy Mayasi", new Stats(26, 26, 3));
        players.put("Lasse J?rgensen", new Stats(33, 0, 0));
    public JTable showPlayers(){
        String[] columnames = {"Spiller", "Kampe", "M?l", "R?de kort"};
        Object[][] data;
        Set<String> key = players.keySet();
        for(String player : key){
           data = {{player, players.get(player).getMatches(), players.get(player).getGoals(), players.get(player).getRedCards()}};          
        final JTable table = new JTable(data, columnames);
        return table;
but on this line Netbeans says that variable is allready defined:
   data = {{player, players.get(player).getMatches(), players.get(player).getGoals(), players.get(player).getRedCards()}};          
I can see the problem is this, but when it cant be done this way, how can i do it then?

Instead of creating the table directly with data values, use a DefaultTableModel whose constructor is very similar. But DefaultTableModel has interesting method as addRow, removeRow... for dynamically handling data (and visually to table).
Set<String> keys = players.keySet();
Object[][] data = new Object[keys.size()][columNames.length];
for(i=0; i<keys.size(); i++) {
   String key = keys.next();
   data[0] = player;
data[i][[1] = players.get(player).getMatches();
data[i][[2] = players.get(player).getGoals();
data[i][[3] = players.get(player).getRedCards();
DefaultTableModel model = new DefaultTableModel(data, columNames );
JTable table = new JTable(model);
Later in your code, as you want to dynamically update the table, work with the model instead of the table to add , remove, change cell values of the table.
+PS : your code loop is probably wrong. You are setting data variable for each value of the set. I suppose you want to add a row to data array. data is a two dimension array+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • How we create dynamic add form field in web form

    How we create dynamic add form field in web form?

    Hi,
    Thanks for reply.
    I need to create a form in which "add more" input field dynamically. For
    example sometime we need field on or more. Please look at the demo, I need
    to create form as per demo in business catalyst:
    http://www.openjs.com/scripts/examples/addfield.php

  • How to bind dynamic row data to submit it by HTTP submit (PHP) - addInstance and Data Binding

    Hi,
    i have got a problem with submit HTTP all data (variables) from PDF to submit.php.
    I have got table with dynamic add/remove Table Row button. When i add it their names are Table.Row[0] , Table.Row[1], Table.Row[2] etc. Only Table.Row is real, and every other row is create dynamically by addInstance script command.
    When i fill "Data Binding" box like this: "Use name(Row)" then after submiting it do PHP i will see only last Table.Row data. For example if last would be Table.Row[3] then i will see only this on my submit.php and the others will be replaced by this value. This is happen becouse of replacing value by value with the same name (data binding is seeing only one Table.Row without instance name:"[1]", "[2]", "[3]" etc.).
    I guess that if i would change something to get addInstance command with Row names like Row1, Row2, Row3 then all will be ok.
    Another way it`s to change something in the "Data Binding" box (Object > Binding Tab) to get relative name like Row[*] instead of "Use name(Row)".
    I don`t know how to solve it and i need your help

    Create a binding for your dataTable.
    In the binding create a UIData element with gettters and setters.
    You can manipulate rows and columns from it.

  • How can I dynamicly add control elements to a  form

    Hello,
    I want to dynamicly add elements to a JPanel.
    The elements with the properties are stored in a database
    each record contains one element
    Label
    Combobox
    Checkbox
    I`m programming in NetBeans 5.5
    Something like:
    public void test()
    try
    stmt = GeneralDBConnect.createStatement();
    ResultSet rs = stmt.executeQuery("select device_option_id, objecttype, device_option, size, location, tooltip from device_option where ...");
    int i = 0;
    if(rs.next())
    i = i + 1;
    switch(rs.getString(2))
    case "Label" : JLabel Element[i] = new JLabel();
    Element.setText(rs.getString(3));
    break;
    case "Textbox" : JTextField Element[i] = new JTextField();
    break;
    case "Combobox" : JComboBox Element[i] = new JCombobox();
    Element[i].setToolTipText(rs.getString(6));
    ResultSet List = stmt.executeQuery("select device_option_value_id, option_value from device_option_value where ...");
    while(List.next)
    Element[i].addItem(List.getString(2));
    List.close();
    break;
    case "Checkbox" : JCheckBox Element[i] = new JCheckBox();
    break;
    jPanel_Device_Option.add(Element[i])
    rs.close();
    stmt.close();
    catch (SQLException ex)
    ex.printStackTrace();
    I know the Element[i] is wrong code but I need to give the elements an unique name.
    Can anyone assist me in this matter

    Hello everybody,
    I figured it out. I had to change the layout model of the JPanel.
    I`ve chosen to use the gridbaglayout because its very flexibel. See http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html
    Here is my code:
    Description:
    Whenever an item in a Combobox is changed (representing devices) the optional elements (a collection of Textfields, checkboxes, comboboxes) are shown in a JPanel.
    Which Elements are shown is stored in a database. (Tabels device, device_option and device_option_value (stores the JCombobox items))
    First create a JPanel in the graphical editor and right click it choose set layout\gridbaglayout
            jPanel_Device_Option.setLayout(new java.awt.GridBagLayout());
            jPanel_Device_Option.setBorder(javax.swing.BorderFactory.createTitledBorder("Device Options"));
            jPanel_Device_Option.setAutoscrolls(true);Then to create an empty border so the elements don`t clip to the edge of the JPanel add the following code in the properties window in the code section under node "Post-Init code"
            Border bBorder = jPanel_Device_Option.getBorder();
            Border bMargin = new EmptyBorder(0,10,0,10);
            jPanel_Device_Option.setBorder(new CompoundBorder(bBorder, bMargin));Then declare the public variables at the beginning of the code
        public static ArrayList aDatasetElements;
        public static JLabel[] aLabel;
        public static JLabel[] aTextfieldLabel;
        public static JTextField[] aTextfield;
        public static JLabel[] aComboboxLabel;
        public static JComboBox[] aCombobox;
        public static JLabel[] aCheckboxLabel;
        public static JCheckBox[] aCheckbox;And now the method that`s creating the elements
      public void setOutputSettings()
          jPanel_Device_Option.removeAll();//Clear all existing elements from the JPanel
          jPanel_Device_Option.repaint();//Refresh the JPanel
          if(jComboBox_Output.getSelectedItem().toString().length() > 0)//Check if any elements should be added
              GridBagConstraints gbConstraint = new GridBagConstraints();//Create a new gridbagcontraint (properties of layout) check http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html
              gbConstraint.fill = GridBagConstraints.HORIZONTAL;
              gbConstraint.anchor = GridBagConstraints.PAGE_START;
              gbConstraint.weightx = 0.5;
              try
                  stmt = GeneralDBConnect.createStatement();
                  /*Collect data from the database (Which elements should be displayed)  
                      deviceoption: The name of the option this is displayed in the elements label as text
                      tooltip: Show a tooltip on both label and element
                      device_optio_id: gets the ID needed to get the list values for a combobox also easy to use when getting the data afterwards (stored in a public variable
                      objecttype: Label, Textfield, Checkbox, Combobox*/
                  ResultSet rsElements = stmt.executeQuery("select device_option, tooltip, device_option_id, objecttype from device_option where deviceid = (select device_id from device where devicename = \'" + jComboBox_Output.getSelectedItem() + "\') order by sequence_order asc");
                  aDatasetElements = new ArrayList(); // Makes an array
                  while(rsElements.next()) //get data in arraylist (a resultset closes after a while (garbitch collector) resulting in errors I recieved some errors resulset allready closed. Also needed to acces data afterwards
                      aDatasetElements.add(new String(rsElements.getString(1)) + " ;" + new String(rsElements.getString(2)) + ";" + new Integer(rsElements.getInt(3)) + ";" + new String(rsElements.getString(4)));
                  rsElements.close();
                  aLabel = new JLabel[aDatasetElements.size()];          //Makes an array
                  aTextfieldLabel = new JLabel[aDatasetElements.size()]; //Makes an array
                  aTextfield = new JTextField[aDatasetElements.size()];  //Makes an array
                  aCheckboxLabel = new JLabel[aDatasetElements.size()];  //Makes an array
                  aCheckbox = new JCheckBox[aDatasetElements.size()];    //Makes an array
                  aComboboxLabel = new JLabel[aDatasetElements.size()];  //Makes an array
                  aCombobox = new JComboBox[aDatasetElements.size()];    //Makes an array
                  for(int i = 0; i < aDatasetElements.size(); i++) //loop through the foundset
                      String sDatasetElements = aDatasetElements.get(i).toString(); //get the data from the array
                      //Creation of Elements of type Label
                      if(sDatasetElements.split(";")[3].equals("Label")) //Check objecttype
                          gbConstraint.gridx = 0; //X position in layout (Label)
                          gbConstraint.gridy = i; //Y position in layout (Label)
                          aLabel[i] = new JLabel(sDatasetElements.split(";")[0], aLabel.TRAILING); //Makes a JLabel at an array place
    aLabel[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aLabel[i], gbConstraint); //Adds a JLabel to the JPanel
    //Creation of Elements of type TextField
    if(sDatasetElements.split(";")[3].equals("Textfield"))
    gbConstraint.gridx = 0; //X position in layout (Label)
    gbConstraint.gridy = i; //Y position in layout (Label)
    aTextfieldLabel[i] = new JLabel(sDatasetElements.split(";")[0], aTextfieldLabel[i].TRAILING); //Makes a JTextfield at an array place
    aTextfieldLabel[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aTextfieldLabel[i], gbConstraint); //Adds a JLabel to the JPanel
    gbConstraint.gridx = 1; //X position in layout (Element)
    gbConstraint.gridy = i; //Y position in layout (Element)
    aTextfield[i] = new JTextField(); //Makes a JTextfield at an array place
    aTextfield[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aTextfield[i], gbConstraint); //Adds a JTextField to the JPanel
    //Creation of Elements of type Checkbox
    if(sDatasetElements.split(";")[3].equals("Checkbox"))
    gbConstraint.gridx = 0; //X position in layout (Label)
    gbConstraint.gridy = i; //Y position in layout (Label)
    aCheckboxLabel[i] = new JLabel(sDatasetElements.split(";")[0], aCheckboxLabel[i].TRAILING); //Makes a JLabel at an array place
    aCheckboxLabel[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aCheckboxLabel[i], gbConstraint); //Adds a JLabel to the JPanel
    gbConstraint.gridx = 1; //X position in layout (Element)
    gbConstraint.gridy = i; //Y position in layout (Element)
    aCheckbox[i] = new JCheckBox(); //Makes a JCheckbox at an array place
    aCheckbox[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aCheckbox[i], gbConstraint); //Adds a JCheckbox to the JPanel
    //Creation of Elements of type Combobox
    if(sDatasetElements.split(";")[3].equals("Combobox"))
    gbConstraint.gridx = 0; //X position in layout (Label)
    gbConstraint.gridy = i; //Y position in layout (Label)
    aComboboxLabel[i] = new JLabel(sDatasetElements.split(";")[0], aComboboxLabel[i].TRAILING); // Makes a JLabel at an array place
    aComboboxLabel[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aComboboxLabel[i], gbConstraint); //Adds a JLabel to the JPanel
    gbConstraint.gridx = 1; //X position in layout (Element)
    gbConstraint.gridy = i; //Y position in layout (Element)
    aCombobox[i] = new JComboBox(); //Makes a JCombobox at an array place
    aCombobox[i].setToolTipText(sDatasetElements.split(";")[1]);
    jPanel_Device_Option.add(aCombobox[i], gbConstraint); //Adds a JCombobox to the JPanel
    //Get the listvalues from the database option_value is the value that is shown in the list
    ResultSet rsValuelist = stmt.executeQuery("select option_value from device_option_value where device_optionid = " + sDatasetElements.split(";")[2] + " and (option_state = " + iOptionState + " or option_state = 40) order by sequence_order");
    while(rsValuelist.next())
    if(rsValuelist.getString(1) == null)
    aCombobox[i].addItem("");
    else
    aCombobox[i].addItem(rsValuelist.getString(1));
    rsValuelist.close();
    //Place an empty label at the bottom otherwice the labels are centered in the JPanel
    gbConstraint.anchor = GridBagConstraints.PAGE_END;
    gbConstraint.weighty = 1.0;
    gbConstraint.gridx = 0;
    gbConstraint.gridy = aDatasetElements.size() + 1;
    jPanel_Device_Option.add(new JLabel(""), gbConstraint); //Adds an empty JLabel to the JPanel
    catch (SQLException ex)
    ex.printStackTrace();
    The is triggered in the init method and the event Item changed of the JCombobox
    private void jComboBox_Output_ItemStateChanged(java.awt.event.ItemEvent evt) {                                                  
          //Removed some irrelevant code here
          setOutputSettings();
        }To collect the data that the user has entered in the elements
    private void jButton_Collect_User_Data_ActionPerformed(java.awt.event.ActionEvent evt) {                                              
          String sList = "";
          for(int i = 0; i < aDatasetElements.size(); i++)
              String sDatasetElements = aDatasetElements.get(i).toString();
              if(sDatasetElements.split(";")[3].equals("Label"))
                  sList = sList + aLabel.getText() + "\n";
    if(sDatasetElements.split(";")[3].equals("Textfield"))
    sList = sList + aTextfield[i].getText() + "\n";
    if(sDatasetElements.split(";")[3].equals("Checkbox"))
    sList = sList + aCheckbox[i].isSelected() + "\n";
    if(sDatasetElements.split(";")[3].equals("Combobox"))
    sList = sList + aCombobox[i].getSelectedItem().toString() + "\n";
    JOptionPane.showMessageDialog(null, sList);
    I hope ths is helpfull information.
    Since I`m totally new to Java it is possible that a different approach is better however this is working for me.
    I`m open for any remarks on the code and feel free to give any comments.
    Kind Regards Rene

  • Dynamically add data points to U.S. Map from excel file?

    Hi,
    I have an illustrator U.S. map and I have an excel spread sheet with 1,000's of zip codes. I need to add dots on my map for each zip code. How do I do that dynamically? This is going into an annual report so the design needs to be kept in Illustrator and the dot style needs to be adjustable.
    Please let me know if there is a solution as opposed to manually looking up the zip codes and copy/pasting 1,000's and 1,000's of dots.
    Many thanks in advance,
    Stacy

    Not sure I follow exactly what you have in mind. You just want to have a dot at the location of each zip code on a map of the US? Are the dots going to be individually labeled? Individually named objects? Isn't there something like 40,000 zip codes in the US?
    You don't provide much information about the problem. What kind of map? Does it already have individual objects drawn in the shape of zip codes and you just want a dot in the middle of each? Are you literally just starting with an outline of the whole US?
    What kind of columns are in your spreadsheet? For example, do you have latitude/longitude data cells for each zip code? I don't think there is any geographical reference system embedded in a zip code. It's just a number.
    Illustrator isn't going to recognize a *shape* as the state of Georgia, for example, unless that object already has some kind of identifier within Illustrator. So obviously, you would need some kind of 2D reference table to tell whatever automation scheme you employ where to place each dot on an XY coordinate grid.
    Such things are available, as described here:
    http://www.maponics.com/index.html
    I suspect you're probably trying to reinvent the wheel here, but it would not be a difficult Javascript problem, once armed with the three-field data. This would be the general scheme:
    1. Start with a data table with three columns: Zip Code, Latitude, Longitude.
    2. Write an AI Javascript which does these things:
    -Contains a function which uses a simple multiplication scheme to effectively scale the Lat/Long values into X and Y divisions of your Artboard area.
    -Contains a loop which cycles through the Lat/Long values, calls the function to translate each into X/Y page coordinates, and places a pre-defined Symbol (an AI Symbol, in the sense of the Symbols Palette) at each coordinate pair. Using Symbol Instances would enable you to use the various Symbols-related commands to later globally swap out or edit the symbols.
    -The script could optionally name each of the instances by its zip code, if necessary.
    3. After running the script, simply scale and position the map (probably on an underlying Layer) proportionally so that two points on it correspond to any two known lat/long coordinates. The rest of the map would then correspond to the dots on the grid.
    But again, I strongly suspect this has all been done before. You could probably buy a vector graphic file like what you need from a map clipart source and then just edit it stylistically for your use.
    JET

  • How to get Dynamic table data  in table

    Actually i want to generate a table by a query . now i m able to get the data in java class but i don't know that how to present that data in a table form in UIX page.

    HI using this methods u can create dynamic internal tables,
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = FIELD_CATALOG
        IMPORTING
          EP_TABLE        = GFINAL.
      ASSIGN GFINAL->* TO <GFINAL>.
      CREATE DATA WFINAL LIKE LINE OF <GFINAL>.
      ASSIGN WFINAL->* TO <WFINAL>.
    Please let me know once the requirement clearly , is the fm or Method importing parameter is internal table , corresponding to that
    internal table you need to fetch data from data base.
    In general , field symbols holds some memory in memory area , I think just like pointers in C language , this holds address only , there we dynamically assign some structure .
    Let me know once if u not cleared ,
    Regards
    Siva

  • How to download dynamic table data into CSV format

    Hi,
    I have data in dynamic table <it_data>, and I want to download that into CSV format.
    so I tried to use FM SAP_CONVERT_TO_CSV_FORMAT but how to use this FM with dynamic table?
    here <it_data> type standard table, we can pass this to I_TAB_SAP_DATA. but problem is with changing parameter. (TRUXS_T_TEXT_DATA), what type of table it should be?
    and one more thing is <it_data> structure is also dynamic , depending on input the structure of <it_data> may vary.
    Regards,
    Mrunal

    Hi,
    check this one may be help full to u...........
    *Use FM SAP_CONVERT_TO_CSV_FORMAT and pass a Delimiter and ITAB. This
    returns an Ouput_String
    Convert Internal Table to ; delimited format
    There is a filename parameter on this FM but I don't think it's used
    call function 'SAP_CONVERT_TO_CSV_FORMAT'
    exporting
    i_field_seperator = Delimiter "default ';'
    i_filename = Filename
    tables
    i_tab_sap_data = ITAB
    changing
    i_tab_converted_data = Ouput_String
    exceptions
    conversion_failed = 1
    others = 2.
    Regard's
    SHAIK.

  • How to set dynamic expiration date in User Task

    Hi
    I need to set the expiration date of a User Task to a specific date, not a duration. Is it possible to do this?

    I have also got a smiliar problem. Does anyone have any further information to how this can be achieved?
    I have been able to use the Human Task Wizard screen (<usertask>.task) to hard code the expiration time. Using the Fixed Duration option of days, hours or minutes. I have tried to use the 'By Expression' to do this but have been unable to get it to work. I have tried to select the /task:task/task:systemAttributes/task:expirationDuration or the /task:task/task:systemAttributes/task:expirationDate element within the task workflow xsd but are unsure how to get it to read the date. I have tried to assign a time component to expirationDate and a time period P0DT0H20M to the expirationDuration element.

  • HOW TO VIEW & EDIT/ADD DATA TO ICAL FROM WINDOWS XP

    I am new to macs & have been using windows xp at my office. I want to know whether there is a way to edit/add my ical calendars & to-do lists from windows xp. I tried using mozilla calendar but it is pathethic. ical data is not compatible with outlook 2003 & entourage for mac os x is also not comaptible with outlook even when both are made by microsoft. Now I'm stuck with either ical or outlook or entourage . I know that entourage data can be imported in ical but I wanna edit/add the calendars/to do list on a windows pc. please help

    I would also like to know if this is possible.
    I manage a band and currently we use a bravenet web calendar to keep track of gigs and people's availability. Band members can access the calendar via a web browser and update their availability.
    They are windows users and I use a mac. I know that they can access my ical calendar as read only but I would like for them to be able to add stuff to a calendar that is sync'd in some way to my ical calendar so I don't need to update both the bravent calendar and my ical calendar.
    It would be great if someone could help with this please
    Thanks,
    Mike

  • How to set dynamically row data in datatable

    hi All.
    i have a datatable with columns and listeners as below.
    //pstBildirimAyrList.jsp
    <h:dataTable id="table1"
    value="#{pc_PstBildirimAyrList.pd_pstBildirimAyrListData.pstBildirimAyrBean}"
    var="varpstBildirimAyrBean" >
    <h:column id="column8">
    <f:facet name="header">
    <h:outputText styleClass="outputText" value="Personal ID" id="text15"/>
    </f:facet>
    <h:inputText id="bki_birey_id"
         value="#{varpstBildirimAyrBean.bki_birey_id}"
         styleClass="inputText"                         onchange="this.form.submit();"
         valueChangeListener="#{pc_PstBildirimAyrList.changeValuesForId}"
         immediate="true" >
              <hx:validateConstraint regex="DigitOnly" />
    </h:inputText>
    </h:column>
    <h:column id="column9">
    <f:facet name="header">
    <h:outputText styleClass="outputText" value="Name" id="text17"/>
    </f:facet>
    <h:inputText id="bki_birey_adi" value="#{varpstBildirimAyrBean.adi}"
         styleClass="inputText" maxlength="50" required="true"
    style="text-align: left">
    </h:inputText>
    </h:column>
    </h:dataTable>
    //faces-config file is
    <managed-bean>
         <managed-bean-name>pc_PstBildirimAyrList</managed-bean-name>
         <managed-bean-class>pagecode.pst.PstBildirimAyrList</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <managed-bean>
         <managed-bean-name>pd_pstBildirimAyrListData</managed-bean-name>
         <managed-bean-class>com.vadi.pst.data.PstBildirimAyrData</managed-bean-class>
         <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    if i changed bki_birey_id((UIInputText)) value, i want to change automatically (by searching in Database) bki_birey_adi (UIInputText) .
    For this reason, I added a listener to bki_birey_id. its code is below.
    PstBildirimAyrList.java
    public void changeValuesForId(ValueChangeEvent valueChangedEvent) {
         HtmlDataTable dt = (HtmlDataTable) (facesContext
                             .getViewRoot()
                             .findComponent("form1")
                             .findComponent("table1"));
         PstBildirimAyrBean pstBildirimAyrBean = (PstBildirimAyrBean) dt.getRowData();
         if (valueChangedEvent.getComponent().getId().equals("bki_birey_id")) {
              HtmlInputText birey_id = (HtmlInputText) dt.findComponent("bki_birey_id");
              HtmlInputText birey_adi = (HtmlInputText) dt.findComponent("bki_birey_adi");
              HtmlInputText birey_soyadi = (HtmlInputText) dt.findComponent("bki_birey_soyadi");
              try {
                   BkiBireyBean bkiBireyBean =
                        (new BkiBireyDBAO()).fetchByPrimaryKey(
                   Long.parseLong(birey_id.getValue().toString()));
                   birey_adi.setValue(bkiBireyBean.getAdi());
                   birey_soyadi.setValue(bkiBireyBean.getSoyadi());
              } catch (Exception e) {
                   birey_adi.setValue("-");
                   birey_soyadi.setValue("-");
    it's look like true. but When page is return, bki_birey_adi is not set.
    what's wrong?
    please help me.
    Thanks in advance.
    Note : i'm sorry for down spelling.

    Create a binding for your dataTable.
    In the binding create a UIData element with gettters and setters.
    You can manipulate rows and columns from it.

  • Handling dynamic item data in VSTS

    Hi Team,
    Can you please let us know how to handle dynamic item data in VSTS.
    Regards
    Raghavendra
    8105577088

    Hi Raghavendra,
    Based on your previous threads posted by you in the test forum, I doubt that you want to create the coded UI test, am I right?
    If so, which kind of app did you want to test, WPF or others? Could you share us a screen shot about the real UI controls you want to test? What real Controls you want to test, list item controls or others?
    You know that to find a control in coded UI test, we have to use the unique peoperties as the search properties, so if your controls are dynamic, the real issue would be related to the search properties you use in your code.
    Like this case:
    https://social.msdn.microsoft.com/Forums/en-US/4c4805f0-230d-459d-a3e5-61e62746c5b9/list-box-item-is-not-get-selected-while-play-back-the-recorded-script-in-coded-ui-test?forum=vsautotest
    As Pankaj's suggestion, if the list items are dynamic then you can use the index values instead of the innertext, so the real issue would be related to how to use the search perperties in your side. If you item text value is dynamic, you'd better not
    use the text value as the search properties. 
    About "How does “Coded UI test” finds a control ??", reference:
    http://blogs.msdn.com/b/balagans/archive/2009/12/28/9941582.aspx
    If I have misunderstood this issue, please feel free to let me know.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Dynamic add row/columns to data forms(11.1.1.3) v/s (11.1.2.1)

    Hello All,,
    There used to be an option in Hyperion planning 11.1.1.3 to Dynamic add rows in data form. I don't see this option in planning 11.1.2.1 ?
    Could you please suggest how we can grant right users to add dynamic add rows and columns in data forms? or it is possible in 11.1.2.1 ?
    out user want to have a feature of adding row in data forms (planning forms)
    Thank you
    Edited by: 842804 on Aug 17, 2011 12:49 PM

    Do you mean 11.1.2, if so then adhoc web forms really take over from adding rows as they add much more functionality.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Dynamic add row/columns to data forms(11.1.1.3) v/s (11.1.1.2)

    Hello All,,
    There used to be an option in Hyperion planning 11.1.1.3 to Dynamic add rows in data form. I dont see this option in planning 11.1.1.2 ?
    Could you please suggest how we can grant right users to add dynamic add rows and columns? or it is possible in 11.1.1.2
    Thank you

    How about ad-hoc analysis? Have a read of this: http://download.oracle.com/docs/cd/E17236_01/epm.1112/hp_user/ch04s02s03.html
    Cheers,
    Mehmet

  • How to maintain dynamic rows with data when click on Previous button?

    Hi,
    I have 1 aspx page and divided into 3 pages using panels.Each panel has "Next" and Previous buttons
    I have created and deleted dynamic table rows when click on Add button using javascript. whenever i click on Next button it will navigate to same page of next panel.
    when i click on previous button then it goes to previous panel but whatever i have added dynamic table rows in 1st panel that got removed.
    Can u please help me for how to maintain state of dynamic table rows with entered data when click on Previous button?
    How to get dynamic table rows with entered data in previous panel when click on Previous button?
    Please find the below javascript code:
    function insertRow() {
    if (index >= 2) {
    document.getElementById('deleteRow').style.display = "inline";
    else { document.getElementById('DeleteRow').style.display = "none"; }
    var table = document.getElementById("myTable");
    var row = table.insertRow(table.rows.length);
    cell1 = row.insertCell(0);
    t1 = document.createElement("select");
    t1.options[t1.options.length] = new Option('--Select--', '0');
    t1.id = "ddlYear" + index;
    cell1.appendChild(t1);
    for (var i = 1975; i <= 2015; i++) {
    opt = document.createElement("option");
    opt.value = i;
    opt.text = i;
    t1.add(opt);
    t1.style.width = "155px";
    var cell2 = row.insertCell(1);
    t2 = document.createElement("Select");
    t2.options[t2.options.length]=new Option('--Select--','0');
    t2.options[t2.options.length]=new Option('State Board','1');
    t2.options[t2.options.length]=new Option('CBSE','2');
    t2.options[t2.options.length]=new Option('ICSE','3');
    t2.options[t2.options.length] = new Option('Others', '4');
    t2.style.width = "155px";
    t2.id = "ddlCourse" + index;
    cell2.appendChild(t2);
    var cell3 = row.insertCell(2);
    t3 = document.createElement("input");
    t3.id = "txtCity" + index;
    cell3.appendChild(t3);
    var cell4 = row.insertCell(3);
    t4 = document.createElement("input");
    t4.id = "txtInstitute" + index;
    cell4.appendChild(t4);
    var cell5 = row.insertCell(4);
    t5 = document.createElement("Select");
    t5.options[t5.options.length] = new Option('--Select--', '0');
    t5.options[t5.options.length] = new Option('English', '1');
    t5.options[t5.options.length] = new Option('Hindi', '2');
    t5.options[t5.options.length] = new Option('Telugu', '3');
    t5.options[t5.options.length] = new Option('Others', '4');
    t5.style.width = "155px";
    t5.id = "ddlMedium" + index;
    cell5.appendChild(t5);
    var cell6 = row.insertCell(5);
    t6 = document.createElement("input");
    t6.id = "txtSpecialization" + index;
    cell6.appendChild(t6);
    var cell7 = row.insertCell(6);
    t7 = document.createElement("input");
    t7.id = "txtFnl" + index;
    cell7.appendChild(t7);
    index++;
    function DeleteRow(index) {
    var table = document.getElementById("myTable");
    table.deleteRow(index);
    // if (index = 2) { alert("There is no rows added.Please add the new row"); }
    Design:
    <tr style="font-size: 12pt" id="trSecond" runat="server">
    <td colspan="3">
    <table id="myTable" width="100%" border="0">
    </table>
    <tr>
    <td colspan="3" align="right">
    <input type="button" title="Add" value="Add" onclick="insertRow();" />
    <input type="button" id="deleteRow" title="Delete" value="Delete Row" onclick="DeleteRow(this);" style="display:none" />
    </td>
    </tr>
    Thank you.

    Put the button click into an action listener and build the new frame there. The code I have below isn't exactly what you're doing (it's amazingly oversimplified), but it's probably similar enough to get your wheels turning in the right direction.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class sample
         public static void main(String[] args)
              JFrame frame = new JFrame("Sample");
              frame.setSize(400,400);
              Container content = frame.getContentPane();
              content.setLayout(new FlowLayout());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              final JTextField text = new JTextField(10);
              content.add(text);
              JButton button = new JButton("Send");
              content.add(button);
              frame.setVisible(true);
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        JFrame myframe = new JFrame("Results");
                        myframe.setSize(200,200);
                        Container mycontent = myframe.getContentPane();
                        mycontent.setLayout(new FlowLayout());
                        String mytext = text.getText();
                        JLabel label = new JLabel();
                        label.setText(String.valueOf(mytext));
                        mycontent.add(label);
                        myframe.setVisible(true);
    }

  • How do i add data from database to JTable ! Urgent

    How do i add data from database to the columns of JTable?.

    hi,
    Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this...

Maybe you are looking for