Friday, September 21, 2012

ADF Create and CreateInsert Operations for ADF Table

I bet every ADF developer was wondering in his life at least once - what operation to use to insert new row into ADF table - Create or CreateInsert. This one is a must question from developer who starts ADF development. Answer - use CreateInsert operation to insert new rows into ADF table or form. Create operation works with form component only. However, this is not so obvious - I saw such situations when developers where stuck for some time, because they were unable to implement new row insertion (just because of using Create, instead of CreateInsert). It looks like CreateInsert operation calls additional functionality to push newly created record and really display it in ADF table just after operation is completed. But Create operation is missing that part. I will describe in this post with example.

Download test case application - Test case contains simple page, both operations Create and CreateInsert are implemented directly from Data Control:

There is only one page, where I have both ADF form and table. Same Create and CreateInsert operations are applied for both blocks:

Operations are defined in Page Definition file:

Firstly we test Create operation - press Create button for the table:

There is no new row rendered in the table, but new row was inserted only into form component - this is a problem most of new ADF developers are facing. User gets confused - press second time on Create and ADF will show validation errors for missing required fields in the form:

CreateInsert operation behaves much better - press CreateInsert button and you will see new blank row inserted into ADF table. User is ready to type data and commit it. Also new row was inserted into form component - this means CreateInsert works for form and table:


MinBzid said...

Hello Andre!
i built a tree which has many levels!! so i need to insert values for a specific level so i wonder if i can achieve this with -> create!i need to create a new row and in the same time to keep the Parent_id "the level" i am at..

Best Regards

Francesco Savino said...

Hello Andrejus , but what is the real kind of row that ViewObject retain when I use the Create operation ? it is a row with a corresponding entity but just non commited , is a row just inside the ViewObject's iterator or is just a row retained by ADF form ?
And How I can retrive this row just created if don't have holder variables at pageDef (this is the point ! I rely on some place where row is maintained ..)