Hi
I have following datagrid where, if I change the value in column “Rating manager cy” the value in column “Raise amount budget” in the same row is calculated automatically. However, this column’s total (here 18,800) remained unchanged. After I save and reload, it shows the updated sum value. How can I have it updated in real-time?
Hi!
I can’t reproduce your problem. In my case aggregation is updated the moment the value in the column is updated. The aggregation column is updated if the set of dataGrid
items is changed (see io.jmix.flowui.component.delegate.AbstractGridDelegate#itemsItemSetChanged
).
Check if the data is being saved to the container associated with the dataGrid
?
Regards,
Dmitriy
Hi Dmitriy
That’s right, it works when it is changed in items of the data grid. However, I have the following code that is at the container level and that’s why it’s not working. How can I use the user interaction to calculate and show the SUM immediately, any suggestions?
@Subscribe(id = "salaryReviewsDc", target = Target.DATA_CONTAINER)
public void onSalaryReviewsDcItemPropertyChange(final InstanceContainer.ItemPropertyChangeEvent<SalaryReview> event) {
if("performScoreMgr".equals(event.getProperty()) && event.getItem().getPerformScoreMgr()!=null) {
if (event.getItem().getPerformScoreCalibrated() == null) {
double percent = inteaccCompensationMgtServiceBean.getRaisePercentFromSalaryReviewEventAndPerformanceRating(getEditedEntity().getSalaryReviewEvent(), event.getItem().getPerformScoreMgr());
event.getItem().setRaisePercentBudget(percent);
event.getItem().setRaiseAmountBudget(calcRaiseAmount(event.getItem()));
}
You can only reset the DataGrid aggregate property for manual recalculation. Or refresh data container for automatic recalculation.