Showing posts with label setNewRowState. Show all posts
Showing posts with label setNewRowState. Show all posts

Friday, December 11, 2009

adding 1 or more blank rows to your af:table for data entry

Boy am I embarressed. I read the whole 1160 ADF 10g developers guide for 4GL developers from Oracle, have professional experience with building ADF, and claim to be becoming an expert in all this stuff.

But I had failed in getting this simple thing done before successfully: have more than one rows availble in an af:table to allow data entry. I kept running into trouble with validation on the second row. I knew how to do what I wanted in Oracle*forms, just not ADF/BC/ADF Faces!

To my credit though I am sure I must have inquired of the JDev Forum at least once before on this subject. Literally I had come up with an "alternative" solution on a prior contract, but it was WRONG!

The correct solution is very simple: like it says in the manual: whenever you do a VO.create(); follow that by taking the resulting row and saying resultingRow.setNewRowState(Row.STATUS_INITIALIZED);

Then you can VO.insertRow(resultingRow), or do whatever you want.

The odd part of this is, I guess, if you have overridden your initDefaults in the VO's entity, using the entity's setters may changed the status of this VO row from STATUS_INITIALIZED to STATUS_NEW. I kinda figured that if you have setter method calls (e.g., this.set...(blah))in that method that you would not "dirty" your row or entity. I guess that is not right.

At any rate: that's how it is supposed to be done.

So embarressed.