English
triggerCalAndUIEvent
About 310 wordsAbout 1 min
2025-12-15
bizApi.triggerCalAndUIEvent(param)
Triggers UI events and calculation
Parameters
| Parameter | Description | Type | Required |
|---|---|---|---|
| masterData | Master-object data | Object | No |
| objApiName | Current object that initiates the calculation | String | Yes |
| details | Detail-object data | Object | No |
| parseParam | Intercepts and modifies request parameters before calculation is triggered | Function | No |
| skip | If true, UI events are skipped | Boolean | No |
| noMerge | If true, the framework will not merge calculated data returned from the backend. Usually not needed | Boolean | No |
| dataIndex | rowId of modified detail-object data. Required when calculation is triggered because detail-object data was modified | Array | Required when calculation is triggered by modifying detail-object data |
| newDataIndexs | rowId list of newly added detail-object data | Array | Required when calculation is triggered because detail-object data was added |
| delDatas | Deleted detail-object data | Array | Required when calculation is triggered because detail-object data was deleted |
| extraFields | Additional fields to calculate when the default analyzed fields do not satisfy business needs | Object | No |
| filterFields | Filters common calculation fields | Object | No |
| changeFields | Fields whose value changes trigger this calculation, e.g. ['price','discount'] | Array | Required when calculation is triggered by field value changes |
| noRetry | Whether retry is needed when calculation fails | Boolean | No |
| loadingText | Prompt text during calculation | String | No |
| noLoading | Do not show loading during calculation. Disabling loading may cause concurrent data issues | Boolean | No |
Return Value
Promise
Basic Example
Use a custom button to add / delete / modify detail data and trigger calculation
{
apply() {
return [{
event: 'md.render.before',
functional: this.mdRenderBefore.bind(this)
}]
}
mdRenderBefore(context, param) {
return {
buttons: {
add: [{
action: 'xxx_xx',
label: 'Add some detail-object data',
callBack() {
let newContext = param.api.pluginServiceFactory({
pluginApiName: 'xxx_xx_plugin',
objApiName: 'xxx',
recordType: 'xx'
})
asyncGetDatas().then(datas => {
datas = datas.map(data => {
return {
object_describe_api_name: objApiName,
record_type: recordType,
name: data.name,
price: data.price
}
})
datas = newContext.dataUpdater.add(datas);
let newDataIndexs = [];
datas.forEach(data => newDataIndexs.push(data.rowId));
newContext.bizApi.triggerCalAndUIEvent({newDataIndexs}).then(rst => {
if(rst.statusCode) {
newContext.end(true);
} else {
newContext.end();
}
})
})
}
}]
}
}
}
}