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?
Hello cloucas,
In order to provide you some additional information regarding this issue we need to know the following details:
- Exact build of our controls used (are there any Service Releases for this version installed)
- Browser used for testing and its version
- Is the grid flat or hierarchical
- Are there any Template columns or editors embedded in this grid
- What kind of DataSource is used
If you can attach a sample showing this behavior this will be very helpful too.
You can also check the sample attached to this thread - http://ko.infragistics.com/community/forums/p/63032/320999.aspx#320999 – to see if the same behavior is reproducible there.
Hello Alex, thanks for your response.
For your reference, I am using NetAdvantage version 10.3, on IE 10.
I discovered (after long hours of experimentation) that the problem was the getRow statement; for some reason, the most recent browsers (IE 8 and later) are very slow in executing this function. Furthermore, having this function in a loop makes the delay even longer.
I eventually worked around the problem by removing the loop; instead, whenever the grid gets into edit mode, save its current value into a variable; when the user has entered a new value in the cell and focus has moved to another cell causing the CellUpdated event to fire, I subtract from the total value the saved old value and add the new value and update the total.
It would be nice to have the Cell.OldValue property (as I think the 11.1 version has) available so as to save the trouble of saving the old value in a variable, but this method works so far.
I am very troubled however of the lack of support of controls such as the UltraWebGrid since I am sure that a large number of applications are using it. In the interest of upgrading my application I inquired whether transitioning from the UltrawebGrid to the new WebGrid is easy, but the responses I got suggested to me that I would have to re-write entire control methods and events, which makes it very hard; I also discovered that a lot of functionality offered by the UltraWebGrid is not offered by the WebGrid. This is very disappointing to say the least especially for developers such as myself who have been loyal to IG for many years and who see their applications outlive the components they use. Very sad.