Skip to Content
author's profile photo Former Member
Former Member

Update of aTableviewModel

I try to add a new line to a tableviewmodel with the following code...

/*

  • Speichern der neu angelegten Werte im Bean

  • um diese dann in der Datei kd_okay.jsp vorzublenden

*/

myBean.setKD_name(Strkd_name);

myBean.setKD_plz(Strkd_plz);

myBean.setKD_bemerkung(Strkd_bemerkung);

myBean.setKD_land(Strkd_land);

myBean.setKD_str(Strkd_str);

myBean.setKD_ort(Strkd_ort);

myBean.setDK_tel(Strkd_tel);

int x = 1;

int itrow = viewbean.getModel().getRowCount();

//Schreiben des neuangelegten Records in das Model

//Schreiben der Änderung in Tabelle für die Anzeige

viewbean.getModel().setValueAt(Akd_name, itrow, 1);

viewbean.getModel().setValueAt(Akd_plz, itrow, 2);

viewbean.getModel().setValueAt(Akd_ort, itrow, 3);

viewbean.getModel().setValueAt(Akd_str, itrow, 4);

viewbean.getModel().setValueAt(Akd_land, itrow, 5);

viewbean.getModel().setValueAt(Akd_tel, itrow, 6);

viewbean.getModel().setValueAt(Akd_bemerkung, itrow, 7);

itrow = itrow + x;

String Strrow = String.valueOf(itrow);

viewbean.setRowCount(Strrow);

my code works, but only the last new record is visible in the tableview in my jsp site.

have anybody a solution for my problem, perhaps a way to refresh the tableview in the jsp site ???

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2004 at 05:15 PM

    Hello Thomas,

    i alway make i new Table view when the Data has changed. With a method like this in the Bean:

    public void TableRefresh(Vector alleDatensaetze)

    {

    Vector data = alleDatensaetze;

    Vector colName = new Vector();

    colName.addElement("Project No.");

    colName.addElement("Last Modification");

    colName.addElement("Project Name");

    colName.addElement("Creation Date");

    model = new DefaultTableViewModel(data, colName);

    model.setKeyColumn(1);

    }

    The Table View in the JSP looks like this:

    <hbj:tableView

    id="myTableView"

    model="myBean.model"

    design="ALTERNATING"

    headerVisible="false"

    footerVisible="true"

    fillUpEmptyRows="true"

    navigationMode="BYPAGE"

    selectionMode="SINGLESELECT"

    visibleFirstRow="<%=myBean.getVisibleFirstRow() %>"

    visibleRowCount="10"

    rowCount="2"

    onNavigate="myOnNavigate">

    <% myTableView.setOnRowSelection("myOnRowSelection");

    myTableView.useRowSelection(myBean.getOldTableView());%>

    </hbj:tableView>

    As You see the table view uses Attribut "model" in the Bean and the Method refreshed model. It works fine.

    Best Regards,

    Patrick

    http://www.NetWeaver-Forum.de

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.