cancel
Showing results for 
Search instead for 
Did you mean: 

Update of aTableviewModel

Former Member
0 Kudos
285

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 ???

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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