:: Forum >> Version 2 >>

performing Arithmetic in AW grids

Hi

We want to implement a complex grid in which we want to perform Arithmetic in the grids.
I want to add/concatenate the data from 5 th and 6th column and set the resulting data in 7th column.
I am using the following codebase to perform this calculation.But its giving me errors and webpage becomes blank.
We are using AW 2.0.1 for creating our grids.

obj.setCellData(function(column, row) {
return (this.getCellValue(5, row) + this.getCellValue(4, row));
},6,row);

This code base gives error like " 'row' is undefined ".Please help to resolve this issue.
Thanks
Vikramaditya Garg
Fidelity Investments
Vikramaditya Garg
Monday, June 26, 2006
You don't need the last argument in setCellData method when you assign the function to all rows. If you declare the calc function separately - the syntax is less confusing -

function sum(columnrow){
    return 
this.getCellValue(5row) + this.getCellValue(4row);
}

obj.setCellData(sum6);

 
Alex (ActiveWidgets)
Monday, June 26, 2006
Hi Alex

The soluation you have suggested is not working.There is no impact of concatenation.
Can you please suggest an alternative solution
thanks.
Vikramaditya Garg
Vikramaditya Garg
Monday, June 26, 2006
function sum(columnrow){
    return 
Number(Number(this.getCellValue(5row)) + Number(this.getCellValue(4row)));
}
obj.setCellData(sum6); 
 
Paulo Cesar Silva Reis (PC from Brazil)
Tuesday, June 27, 2006
The above solution is still misleading.
I found a better way to do the same
obj.onCellValidating = function(text, column, row){
this.setCellText(parseInt(this.getCellText(getHeaderIndex("buy"),row))+parseInt(this.getCellText(getHeaderIndex("holding"),row))-parseInt(this.getCellText(getHeaderIndex("sell"),row)),getHeaderIndex("final"),row);
}
else {
alert("Please enter the valid data");
}
}
function getHeaderIndex(header) {
for(i=0;i<columns.length;i++) {
if(columns[i]==header) {
return i;
}
}
}
Vikramaditya Garg
Tuesday, July 11, 2006
This function doesn't work in PHP-MySQL-Apache-ActiveWidgets.

Can any one tell me why?
Ashish
Thursday, September 14, 2006
ActiveWidgets has nothing to do with PHP or MySQL or even Apache..... You MySQL can hold you data... Your Apache can be used to fire your PHP which is in charge of making sure that ActiveWidgets and your other HTML/Javascript gets to the browser intact.

If you are having a problem, I might suggest narrowing it to one of the four components you mentioned, and then ask a more pointed question so we can help you.

Good luck
John Mason
Wednesday, January 3, 2007



This topic is archived.

Back to support forum

Forum search