I'm having a little trouble calculating column totals in a grouped grid. I've started from the sample code in http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=3467, and I can calculate row totals fine. Here is the code I'm using in the AfterExitEditMode handler:
function UltraWebGrid1_AfterExitEditModeHandler(gridName, cellId){ try { var cell = igtbl_getCellById(cellId); var row = cell.getRow(); // update row and column totals // snip... row totals are fine // deal with column totals if(row.ParentRow.GroupByRow) { // ParentRow is the group row, get child rows (ie rows in this group) var rows = row.ParentRow.getChildRows(); // get column to update var column = cell.Column; var colTotal = 0; for(var i = 0; i < rows.length; i++) { colTotal += parseFloat(row.ParentRow.getChildRow(i).getCellByColumn(column).getValue()); } alert(colTotal); // place value in column footer // snip... I'll worry about this later } } catch(ex) { alert(ex.message); }}
The problem is that row.ParentRow.getChildRow(i) returns null. I have also tried rows.getRow(i) - but the rows collection, while it is a collection and has the right length, doesn't even have a getRow method. I have also tried row.ParentRow.FirstChild, which also returns null.
Anybody know how to do this?
Well, in case anyone is interested, I thought I'd update this... It turns out that this code works perfectly unless you have enabled AJAX on the grid. Which is a tad annoying. Stil, now we know what the problem is, hopefully we're one step closer to a solution. I'm pursuing this with Infragistics EU support, and I'll update this thread should we find a resolution.
Hi,
I got the same problem, row.ParentRow.getChildRow(i) returns null, do you have a final solution?
Thanks,
Michael