3.2.0

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
June 26,
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(column, row){
    return this.getCellValue(5, row) + this.getCellValue(4, row);
}

obj.setCellData(sum, 6);
Alex (ActiveWidgets)
June 26,
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
June 26,
function sum(column, row){
    return Number(Number(this.getCellValue(5, row)) + Number(this.getCellValue(4, row)));
}
obj.setCellData(sum, 6);
Paulo Cesar Silva Reis (PC from Brazil)
June 27,
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
July 11,
This function doesn't work in PHP-MySQL-Apache-ActiveWidgets.

Can any one tell me why?
Ashish
September 14,
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
January 3,

This topic is archived.

See also:


Back to support forum