ryansuitposungkono / openjs-grid

Automatically exported from code.google.com/p/openjs-grid
0 stars 0 forks source link

Adding 2 columns with SUM instead of CONCAT #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.
First off, let me just say, that this is really amazing code. I have only been 
using php/mysql and javascript for less than a year, and setting up your grid 
was very easy, and the final product looks great.  

I would like users to set different variables to interact with the table, i.e 
changing the cost of a widget would update the grid with new profit. 
Is there a way to have a column that shows the sum of 2 other columns, or show 
1 column value times a variable?

Original issue reported on code.google.com by david...@gmail.com on 23 Aug 2012 at 3:23

GoogleCodeExporter commented 9 years ago
I figured it out, just had to add single quotes around the php var

$grid->fields = array(
        "gross_preship"=>"CONCAT(`ship_cost` + `ship_cost_win` +'$var_test')",
        "gross_profit"=>"CONCAT('$gross_preship' + `ship_cost_win` +'$var_test')",
                );

Original comment by david...@gmail.com on 23 Aug 2012 at 5:56