How can I add a row at the bottom of the table ?

Hi,
I have an application table and I want to make sure that whenever user tries to add a row to the table, the row should be added at the bottom.
Does anyone know how to implement it or point me in the right direction ?
Thanks,
Akshay

Hi,
have a button with actionListener as following
    private void insertBlankRecordForViewObject(ViewObject vo) {
        Row lastRow = vo.last();
        Row newRow = vo.createRow();
        newRow.setNewRowState(Row.STATUS_NEW);
        if (lastRow != null) {
            int indx = vo.getRangeIndexOf(lastRow) + 1;
            vo.insertRowAtRangeIndex(indx, newRow);
        } else {
            vo.insertRow(newRow);
        logger.info("inserted blank record for vo : " + vo.getName());
    public static DCIteratorBinding findIterator(String iteratorName) {
        if (iteratorName == null) {
           // LOGGER.warning(String.format("iteratorName cannot be null", iteratorName));
            return null;
        if (iteratorName.isEmpty()) {
            //LOGGER.warning(String.format("iteratorName cannot be empty", iteratorName));
            return null;
        DCIteratorBinding itrBinding = getDCBindingContainer().findIteratorBinding(iteratorName);
        if (itrBinding == null) {
           // LOGGER.warning(String.format("DCIteratorBinding [%s] not found", iteratorName));
            return null;
        return itrBinding;
    public static DCBindingContainer getDCBindingContainer() {
        return (DCBindingContainer)getBindingContainer();
    public static BindingContainer getBindingContainer() {
        return getBindingContext().getCurrentBindingsEntry();
         public static BindingContainer getBindingContainer() {
        return getBindingContext().getCurrentBindingsEntry();
    public static DCBindingContainer getDCBindingContainer() {
        return (DCBindingContainer)getBindingContainer();
    public void onAddRowAtLast(ActionEvent actionEvent) {
        insertBlankRecordForViewObject(findIterator("MyVOIterator").getViewObject());//iter from page binding to which table is binded
    }Regards,

Similar Messages

  • How can I add a row into a JTable with JButton

    Hi all. I have the following code:
    package gui;
    import db.*;
    import javax.swing.table.AbstractTableModel;
    import java.util.ArrayList;
    public class FoundersTable extends AbstractTableModel{
        private static final int COLUMNS = 8;
        private String columnNames[] = {"��� ����", "���", "�������", "�������", "���������", "��������",
                "����� �� ����������", "������ �� ����, �����"};
        private ArrayList data;
        public FoundersTable(){
            data = new ArrayList();
        public int getRowCount() {
            return data.size();
        public int getColumnCount() {
            return columnNames.length;
        public String getColumnName(int colIndex) {
            return columnNames[colIndex];
        public Object getValueAt(int rowIndex, int columnIndex) {
            return ((ArrayList)data.get(rowIndex)).get(columnIndex);
        public void setValueAt(Object value, int rowIndex, int columnIndex) {
            ((ArrayList)data.get(rowIndex)).set(columnIndex, value);
            fireTableCellUpdated(rowIndex, columnIndex);
        public void addRow(ArrayList neueZeile) {
            data.add(neueZeile);
            int index = data.size() - 1;
            fireTableRowsInserted(index, index);
        public void removeRow(int index) {
            data.remove(index);
            fireTableRowsDeleted(index, index);
        public void removeAllRows() {
            data.clear();
            fireTableRowsDeleted(0, 0);
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
    }Now in my MainJFrame class I have one button for additing and one button for removing a selected row. How can I add/remove rows with this two buttons.
    Thanks

    No my question is how can I add and remove rows WITH buttons My point was the code is the same. You use the addRow(...) method. Why did you write an addRow(...) method if you aren't going to use it?
    I don't understand your problem. Do you not know how to write an ActionListener?

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

  • How can i add two values under the same property?

    Hi all,
    How can i add two values under the same property name in a
    prop list? For example:
    [question1: "item1","item2", question2: "item3","item4"]
    To be more precise, i am creating a property list and I want
    whenever a two values have the same property name to be added int
    he list under the same property. For example:
    gMyList.AddProp (#""&question&"" & x,
    member("input").text)
    question is a variable that is updated fromt he user's input.
    Now, whenever somethign like this happens:
    question = "question1"
    member("input").text = "five"
    question = "question1"
    member("input").text = "six"
    I want to output list to be:
    [question1: "five","six"] and so on
    Any ideas?

    Maybe you could make each property a list (so you have a
    property list full
    of lists), and add multiple values to the list held in a
    particular
    property?
    Cheers
    Richard Smith

  • How can I add a contact on the calendar for an event

    How can I add a contact on the calendar for an event

    It is between Repeat and Alert on my iPhone 5 with iOS 6.0.1
    I used the + on the top right to add the event and when you look vertically starting with the name, followed by location and then time the rest of the default things includ Invitees, among other items. 

  • How can i add a MouseMotionlistener  to the cells in the JTable?

    hi !
    how can i add a MouseMotionlistener to the cells in the JTable?

    yes i have.but that is different from adding MouseMotionlistener to the cells for me .
    i just want get the values where the mouse moves to .

  • How can I add a word to the dictionary?

    How can I add a word to the dictionary on my iPhone 6 plus?
    Thanks.

    There's not an option to add a word to the dictionary. However, after typing that word several times, it will start to recognize it and offer it as a suggested word.

  • How can I add an iView to the Detailed Navigation itself

    How can I add an iView to the Detailed Navigation itself and hides the other hyperlinks?

    To add an iview on the Detailed navigation side of a page:
    1.Double click the page which brings up the page editor.
    2.Click the Display dropdown box and choose Dynamic Navigation.
    3.Add an ivew to it.Save and add the page to a role to see the results.
    if this is not u wanted, post back here.
    Regards.

  • How can I add new songs to the top (not the bottom) of my playlist in iTunes?

    How can I add new songs to the top of my playlist in iTunes?
    I thought thats what it did before but now it automatically adds new songs to the bottom of the list.
    Not a huge issue but an annoyance.

    Go to your Music library
    Then, Click Playlist
    Then, Click the sort arrow until it points down.

  • HT3387 When I use pages the languages that I mainly use are English and Hebrew. The spellchecker works for English but not with Hebrew. How can I add another language to the spellcheck?

    When I use pages the languages that I mainly use are English and Hebrew. The spellchecker works for English but not with Hebrew. How can I add another language to the spellcheck?

    http://m10lmac.blogspot.com/2011/06/extra-spell-checking-dictionaries-for.html

  • How can we add additional fields to the BP Search RESULT screen?

    Dear Experts,
    How can we add additional fields to the BP Search RESULT screen so that the BP's being displayed in a search result show maintained values for the particular column/field?
    Thanks!!!

    Hi Laxman,
                           I got same requirement for ibase hierarchy.I want to add new fields in Ibase hierarchy AB.Do you have any idea regarding this.My requirement is that ,i want to dispaly a fields as a check box which display that this component is in under warranty or not by checking the box.Plz tell ,how can i add a new field in tree type context node.I add a new fields using AET ,but that is not available in that AB.
    Thanks
    Vishwas Sahu
    Edited by: vishwas sahu on Nov 17, 2009 1:51 PM
    Edited by: vishwas sahu on Nov 18, 2009 5:22 AM

  • How can i add Custom fields into the

    Dear Experts
    We have Ecc6.0 system,
    How can i add Custom fields into the Infotype Screen(PA30),i heard that we do it by PM01 Tcode.
    But in PM01 i am unable to find the enhance infotype tab.
    How can i do it ....pls help.....
    Regards
    Sajid

    Hi,
    Do it thru the third tab : Single Screen.
    There write down the infotype number (e.g. 0022) and say generate objects.
    Regards,
    Dilek

  • How can I add sales TAX at the end of my calculations?

    How can I add sales TAX at the end of my calculations?

    We currently do not support adding sales tax.
    Randy

  • How can we delete a line from the table control .

    hi all
    how can we delete a line from the table control .
    situation is.
    created table control in se51 which will display the data of a table.
    how could i select a line from the table control ?
    how could i delete the selected lines form the table.
    thanks in advance

    Change the Table Control attributes such that user can only select a single record(row).
    <u>Tip to delete a selected record</u>
    1) write a module 'Mark' in the PAI as below
    PROCESS AFTER INPUT.
    MODULE cancel AT EXIT-COMMAND.
    LOOP WITH CONTROL table_view.
    MODULE read_table_control.
    FIELD flag MODULE mark ON INPUT.
    ENDLOOP.
    MODULE user_command_0100.
    2) Module Mark is below.
    MODULE mark INPUT.
    CHECK flag = 'X'.
    x = table_view-top_line + sy-stepl - 1.
    Delete itab INDEX x.
    ENDMODULE. " mark INPUT
    Table_view is the TableControl Name.
    'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
    <u>award if uesful</u>
    Regards,
    Sudheer

  • How can I add a linkbutton in the matrix (SBO 7.10.75)

    Hi ,everybody ,I want to add a linkbutton in a matrix ,and it's linkobject is If_PurchaseOder , but there are some errores ,and I don't know why .
    in the SBO2004B ,You can use
    set oLink=oColumn.ExtendedObject
    oLink.LinkObject=If_PurchaseOrder
    but in the SBO7.10.75 , oColunm has no such method.
    How can I do it ?
    thanks

    From the documentation of 2004a:
    Use the LinkedButton object to create a link to another object from a column with a link arrow.
    First, assign this object to a LinkedButton object and then use the LinkedButton object to link the column to the object you want.
    Example
    [Visual Basic] The following sample code shows how to add a column with a link arrow and link it using the ExtendedObject property.
    Dim oLink As SAPbouiCOM.LinkedButton
        Set oColumn = oColumns.Add("A", it_LINKED_BUTTON)
        oColumn.DataBind.SetBound("True","","linkDataSource")
        Set oLink = oColumn.ExtendedObject
        oLink.LinkedObject = lf_BusinessPartner

Maybe you are looking for

  • Can't download Developer Edition CF MX 7 for Windows

    I can download any of the other versions... Linux, AIX, even other language versions, just not Windows, English, ColdFusion MX 7... does anyone know why? Thanks in advance for your help, M ;-)

  • Do I need admin rights to install jdk?

    Hi I tried to download and install jdk 1.4 from java.sun.com, but after installation found out that just the jre part of ht einstallation was successful. The jdk is not installed so I can only run java classes but cannot compile any code. Is this bec

  • Bug? Frame moves after placement. IDCS6

    I've been using IDCS6 for about 2 weeks now and I've noticed that often when I'm moving a frame with a linked graphic in (by clicking on it with the selection tool and dragging the mouse) and snap it to some guides/smart guides, I'll place it and sud

  • HT201269 how can i get all my iphone apps music photos etc. onto my new computer?

    My computer crashed and I now have a new one. I have downloaded itunes. When I connect my phone I don't have the sync option. Why? How do I get my music, apps, photos, etc onto itunes? Why is it not already there?

  • OS X Lion mirroring on iMac "doesn't work"

    I just joined the grumpy imac owners who feel cheated that OS X Lion doesn't support Apple TV mirroring for older iMacs. This is not just acceptable from Apple