Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By ptmi1047

I have a grid with delete row button, and a text field to show total amount from a column in grid.
I do not use grid summary because I need to show the amount with currency format in the field.
How to make the value in text field calculate automatically once I click delete button in grid?

Thank you.
2017-05-19_144838.jpg (29.52 KiB) Viewed 1470 times
By mishika
Hello ,

You can use the JS function onDeleteRow() for grids in order to calculate the sum whenever the row is deleted. Please have a look at the function below:
Code: Select all
$("#gridId").onDeleteRow(function(oGrid, aRow, rowIndex) {
   //code for calculation goes here
  var val = parseInt(aRow[0][4].getValue()); //value of deleted row
  var total = parseInt($('#total').getValue()); //get the value of total and subtract the value of deleted row from it
  var sum = total - val;
Kindly refer to this documentation for more details: ... nDeleteRow

You can change the code according to your requirement.

Hope this helps

Best Regards
Hi Mishika,

Thanks for your solution.
I modified the code since the value in grid using currency format.
Code: Select all

$("#OtherExpenses").onDeleteRow(function(oGrid, aRow, rowIndex) {
    var Total = 0;
    var Amount = parseFloat(toAngka($('#TotOthExp').getValue())); 
    var a1 = aRow[0][4].getValue(); 
    var a2 = a1.replace(",",""); 
    var a = parseInt(a2.replace(",",""));  
    var PPN = $('#PPN').getValue();
    if (PPN == "0"){
        var TotalOth = Amount - a;
    else {

        var TotalOth = Amount - (a + ((a * 10)/100));

    var Summ = toCurr(TotalOth,"");
  	 if (isNaN(TotalOth)) { 
      	TotalOth = '';
   	else { 


ACTE is a national association representing thousa[…]

ACTE is a national association representing thousa[…]

MSSQLConnection.php on line 367

ACTE is a national association representing thousa[…]

Please, something similar is happening to me. I h[…]