Reputation: 61
I have a page with a view object that returns a single row. My intention is to create a row if it's not existing. When entering the page if a row with the certain key exists, the page loads and can also be updated well. When the row with the certain key doesn't exist, the page is not loading correct. The createrow method from the view object is not called. I think I am missing something in my pageDef.
I have tried with invokeAction
<invokeAction id="initEmptyRowSet" Binds="Rollback" Refresh="always"
RefreshCondition="#{bindings.MyVO1Iterator.queryModel == null}"/>
or
<invokeAction Binds="EventTypesExecuteWithParams" id="invokeEventTypes“ Refresh="ifNeeded"/>
<action IterBinding="MyVO1Iterator“ id="EventTypesExecuteWithParams"
InstanceName="MyAppModuleDataControl.AccidentIVVVO"
DataControl="MyAppModuleDataControl" RequiresUpdateModel="true"
Action="executeWithParams">
</action>
What am I missing?
Upvotes: 0
Views: 463
Reputation: 166
You have to call the CreateInsert operation on the VOIterator conditionally. Here your condition is if VOIterator row count is > 0, then don't insert new row else execute the iterator to query the VO.
Here is the sample code.
<iterator Binds="AccidentIVVVO" RangeSize="25"
DataControl="MyAppModuleDataControl" id="MyVO1Iterator"/>
<invokeAction id="createInsert" Binds="CreateInsert"
RefreshCondition="#{bindings.MyVO1Iterator.estimatedRowCount == 0}"
Refresh="ifNeeded"/>
<action IterBinding="MyVO1Iterator" id="CreateInsert"
InstanceName="MyAppModuleDataControl.MyVO1"
DataControl="MyAppModuleDataControl"
RequiresUpdateModel="true" Action="createInsertRow"/>
Upvotes: 1