This is great. I got it working. Thanks a lot Will!!!
It would be great if you could place an example or just tell me what I am missing in my code, since you said I’m very close to my solution.
I think it’s just a matter of returning the appropriate value, since the console log shows me the right values.
I have looked into this but not found a solution as yet.
Thank You Will.
Hey thanks a lot for your reply. My requirements are a bit different.
I have the following code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$grid->setColProperty('Mark', array( "summaryType"=>"js:function(value, name, record) { if(typeof value === 'string'){ value = {ProductSum: 0, MarketValSum: 0 }; } // perform summary if(record['Mark']) { value.ProductSum += parseFloat(record['Mark'])*parseFloat(record['MarketVal']); } if(record['MarketVal']) { value.MarketValSum += parseFloat(record['MarketVal']); } //console.log(value.ProductSum/value.MarketValSum); //console.log(value); return value ; //return (value.ProductSum/value.MarketValSum) }" |
I need weighted means, so I’m calculating the sum of the product of Mark and MarketVal. This sum of the product is then divided by the sum of the MarketVal columns.
The value that I get after the division needs to go into the groupSummary Row in the Mark Column.
You can see that I am writing the values that I get on division into the log. This value is correct in the log. But it displays NaN when I return it. Can you help me how to go about this.
Also I have not used the formatter function, since I think it works without it.
It will be great if you help out since weighted means is something our company needs on a daily basis.
Hi Tony, Thank You for your reply. However, I have not been able to implement this. Is it possible to implement this using the $grid->setColProperty procedure?
Thank You Will
Not quite.
Is there a way in which I can access the summary data of a column, and then use that to calculate the summary for another column.
summaryData(column3)=getAggregateData (column1)/getAggregateData (column2)
Is there a way to save the state of the columns after they have been sorted.
We have multiple users that will use the page and each of them needs the columns in different orders based on their priorities.
Is there a way to use the Session variable in php and then order the columns by itself when the page reloads?
Thanks alot. It works.
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top