Data tables and insertRow() method

I've seen this question a number of times and no answers yet. Is it possible to create a CRUD page with a data table, without creating additional fields outside of the table, I mean, I saw an example with a single page tabular CRUD, but in order to insert a new row, I had to type the new values outside the table, ain't ther a way to do it with the table only? I've tried appendRow, insertRow (which would be the ideal way, since when a table is paginated it doesn't work). I'm sure it shouldn't be that hard, i'm struggling with this for some days now. Could anyone help me? Thanks.

My scenario:

I have a dataprovider, inside my page, that extends ObjectListDataProvider and is set to a class defined by me -> .setObjectClass(UfDTO.class)

I fill the dataProvider list through another list fetched from the sessionbean:

.setList(getSessioBean1.getUfList());

I can delete rows from a checkbox I put into the data table, refresh the data and everything works ok, what i am trying to do, but doesn't work is:

ufListDataProvider.cursorFirst();

RowKey first = ufListDataProvider.getCursorRow();

ufListDataProvider.canInsertRow(first); => returns false!

If I try the appendRow() it works, but once I try to save, the values entered on the data tables field are lost.

[1336 byte] By [marcelotmelo] at [2007-11-14]
# 1

Not sure if this helps cause i'm pretty sure you checked this tutorial already but

http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/ins erts_updates_deletes.html

Shows an example of creating a new rowset in the table itself which the user fills in the fields and saves the information. This might be a slightly different approach at it and not sure if this is what ou want but it's not really doing anything out of the table (as you can put the buttons straight on the table)

r3cca at 2007-7-7 > top of java,Development Tools,Java Tools...
# 2

Yes, I've already looked at the tutorials, there, however, the cachedRowSet is used, and the db table is directly bound to the jsp table, but I don't this tight coupling.

I can call the appendRow method, however when i call the setValue() method on my properties, they remain null. Just to make thigs clearer, I didn't bind my Hibernate entities to the dataProvider, I used another object that is transformed into one or more entities.

That's what I have:

an POJO named UfDTO

public class UfDTO() {

private Integer id;

private String name;

...(getters and setters)

on the SessionBean1

ObjectListDataProvider listDataProvider...

listaDataProvider.setObjectType('com.campo.dto.UfDTO);

...

public String btnAdd_action(){

if(listDataProvider.canAppendRow()){

RowKey rk = ufListDataProvider.appendRow();

ufListDataProvider.setValue("id", new Integer(0));

ufListDataProvider.setValue("id", new String());

}

return null;

}

The code runs fine, with no exceptions, and when I am debugging I can see that after the call to appendRow() a new object is created under the 'appends' properties of the listDataProvider, but even after the calls to setValue, the values of the UfDTO properties into the appends remain null.

marcelotmelo at 2007-7-7 > top of java,Development Tools,Java Tools...