Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1605
UltraWebGrid 2010.3 slow performance when adding row totals
posted

I have an ASP.Net 3.5 application using the Ultrawebgrid to enter timesheet hours. I know that IG has stopped supporting the uwg but I am stuck at the moment trying to decide on when to upgrade to the newer controls (we would normally invest in technologies supported more than 5 years), but I hope somebody seeing this might offer a helping hand; it will surely be greatly appreciated.

Anyhow when the user updates a cell in the grid, a loop is executed (javascript) which adds the column's entries and updates the totals row for that column. The loop is in the shown below:

function grdTimeSheet_AfterCellUpdateHandler(gridName, cellId) {

...............

...............

var grid1 = igtbl_getGridById(gridName);
var cell1 = igtbl_getCellById(cellId);
var cellIndex = cell1.Column.Index;
var RowsCounter = grid1.Rows.length;

//Calculate the new column total and update the totals rows.
var SubTotal1 = 0;
for (c = 0; c < RowsCounter - totalStaticRows; c++) {
//var row1 = grid1.Rows.getRow(c);
var cellValue = grid1.Rows.getRow(c).getCell(cellIndex).getValue();
if (cellValue != null)
{
var val = parseFloat(cellValue);
        if (isNaN(val))
       {
             row1.getCell(cellIndex).setValue(0);
             val = parseFloat(0);
        }
        SubTotal1 = SubTotal1 + val;
       }
}
var TotalChargeableRowIndex = RowsCounter - totalStaticRows;  
grid1.Rows.getRow(TotalChargeableRowIndex).getCell(cellIndex).setValue(SubTotal1);

}

As the number of rows on the grid becomes larger, there is a delay becoming more and more prominent the first time the user updates a cell on a row. After typing the value and hitting tab there is a delay (as long as 40-60 seconds for a grid of 60 rows!) until the focus falls on the next cell. Changing the contents of other cells in the same row is thereafter 1 second fast. Adding a new line to the grid and trying to type on it again gives the same problem.

Can somebody explain what the problem might be? Am I doing something wrong? It seems to me like each time a row cell is accessed the first time, the getRow function used above takes a long time to load the row objects in memory and thereafter keeps them somehow cached somewhere until a cell in a new row is accessed at which case the loading takes place again.

Is there an alternative way of reading the values of the cells in a column from row a to row b and add them up?