Calculate total in editor window
Calculate total in editor window
Hi All
i need to have calculated column based on quantity and price . since im using row grouping plugin ,render method is not working with group total. so i need to know a way to do so in the editor window or at posting time within the editor instance.
i saw Field::inst but its for php i guess. so can some body en light me how to do it in mvc c#.
Thank You
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Just to confirm what you are looking for me - you want a readonly field which contains a value calculated from two other fields? If so, use
dependent()to update areadonlyfield's value (field().val()) when the two input values change.Allan
Thanks Allan
sorry for the late reply.
Achieved through "dependent"
editor.dependent('POPM_Item_ItemCost', function (val, data) {
var quant = Number(editor.field('POPM_Item_ItemCost').val());
var sell = Number(editor.field('POPM_Item_Quantity').val());
var total = quant * sell;
console.log('total is ' + total);
editor.set('POPM_Item_TotalAmount', (total));