编辑或显示数字精度
作者:
控制编辑,设置editParams
public getEditOptions(): EditOptions {
return {
editParams: {
[主表字段名]: () => {
return {
numericProps: {
decimalPlaces: 精度,
minimumValue: '0',
}
}
},
[`子表名.子表字段名`]: () => {
return {
numericProps: {
decimalPlaces: 精度,
minimumValue: '0',
}
}
},
}
}
}
控制显示,子表要自定义渲染
控制千分符:
const fmt = `#,##0.${''.padEnd(precision, '0')}`;
coreUtils.toString(value, fmt);
自定义渲染:
getGridOptions(): Optional<AdvanceGridProps> {
return {
columnResolver: (colDefs: ColDef[]) => {
const daysField = colDefs.find(c => c.field === F_TimesheetLine_days);
if (daysField) {
daysField.cellRendererFramework = (params) => {
return React.createElement('p', null, params.data[F_TimesheetLine_days])
}
}
},
};
}