Skip to main content

Custom page select row sum

1. Usage scenarios

When displaying data on a custom page, you sometimes need to additive operation the selected multiple rows of data, so how can we quickly calculate the sum of selected row values and display them on the page? Here, we will show you how to realize automatic sum of custom page selection lines.

2. Implement functions

2.1 create a custom page

2.2 configuration sum

The code is as follows:

export function onSelectChange(selectedRowKeys, records) {
const sum = records.reduce((prev, cur) => {
return prev + (cur.formData.numberField_lbu52ip3 || 0);
}, 0);
this.$('numberField_lbu5941x').setValue(sum);
}

3. Achieve results

4. Try it online

This doc is generated using machine translation. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes.
Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4