Hi,
This sort of problem has been annoying me for 3 days. I had problem to pass additional criteria to FilterEditor/FilterBuilder, and have problem to pass criteria to nested DynamicForm. The problem is so strange, from the RPC log it shows that the criteria is messed up, instead of passing in the right criteria, some other values are passed in. Apart from it, the DynamicForm gets loaded twice, failure for the first time, and success for the second time, so when it’s loaded, everything looks ok except an error popup.
the first row expansion is normally ok, but it’s almost guaranteed to have problems afterwards.
This nested DynamicForm is used to edit the record. When the record gets loaded, the form will have some SelectItems that contain datasouce generated options.
Here’s some code
/** this is called inside the [b]getExpansionComponent(final ListGridRecord record)[/b]
public VLayout getEditForm(ListGridRecord record) {
....
/** all these values are correctly retrieved **/
String userId = loginUserMap.get("pk_user_id");
String transportRole = loginUserMap.get("transport_role");
String parentConsignor = record.getAttribute("parent_consignor");
String parentCarrier = record.getAttribute("parent_carrier");
String accountCode = record.getAttribute("account_code");
...
...
/** here instantiates a selectitem and criteria to retrieve the option list **/
final Criteria criAccountCode = new Criteria();
criAccountCode.addCriteria("parent_user", userId);
criAccountCode.addCriteria("parent_carrier", parentCarrier);
criAccountCode.addCriteria("parent_consignor", parentConsignor);
selectAccountCode = new SelectItem("account_code", "Account Code");
selectAccountCode.setPickListCriteria(criAccountCode);
selectAccountCode.setOptionDataSource(dsUserCarrier);
selectAccountCode.setDisplayField("account_code");
selectAccountCode.setValueField("account_code");
selectAccountCode.setRequired(true);
selectAccountCode.setOptionOperationId("find.account.codes.for.login.user");
....
....
/** edit the record when it's
layoutForm.addDrawHandler(new DrawHandler() {
public void onDraw(DrawEvent event) {
/** pass in the selected grid record to populate corresponding values **/
formManager.editRecord(record);
}
});
the datasource.ds.xml
<operationBinding operationType="fetch" operationId="find.account.codes.for.login.user">
<selectClause>
*
</selectClause>
<tableClause>
transact_user_carrier
</tableClause>
<whereClause>
parent_user = $criteria.parent_user
and parent_carrier = $criteria.parent_carrier
and parent_consignor = $criteria.parent_consignor
</whereClause>
</operationBinding>
For the first row expansion, the form is loaded only once, but if there’s a problem it gets loaded twice, and the second load is always correct.
The success RPC log (Request)
{
"actionURL":"http://127.0.0.1:8888/transact/sc/IDACall",
"showPrompt":false,
"prompt":"Finding Records that match your criteria...",
"transport":"xmlHttpRequest",
"promptStyle":"dialog",
"bypassCache":true,
"data":{
"criteria":{
"parent_user":"1",
"parent_carrier":"1",
"parent_consignor":"1"
},
"operationConfig":{
"dataSource":"transact_user_carrier",
"repo":null,
"operationType":"fetch",
"textMatchStyle":"startsWith"
},
"startRow":0,
"endRow":75,
"componentId":"isc_PickListMenu_0",
"appID":"builtinApplication",
"operation":"find.account.codes.for.login.user",
"oldValues":{
"parent_user":"1",
"parent_carrier":"1",
"parent_consignor":"1"
}
}
}
The FAILURE RPC log (Request)
{
"actionURL":"http://127.0.0.1:8888/transact/sc/IDACall",
"showPrompt":false,
"transport":"xmlHttpRequest",
"promptStyle":"dialog",
"bypassCache":true,
"data":{
"criteria":{
"account_code":"23456"
},
"operationConfig":{
"dataSource":"transact_user_carrier",
"repo":null,
"operationType":"fetch"
},
"appID":"builtinApplication",
"operation":"find.account.codes.for.login.user",
"oldValues":{
"account_code":"23456"
}
}
}
These two messages are generated by one ListGrid row expansion.
See the criteria gets totally messed up in a failure, the ‘account_code:23456’ is actually the value retrieved from the ListGridRecord, but how come it gets into the criteria?
Please help me, thanks!