Math Calculation between fields

I load a grid from a Table, using:


but i want a calculated column: PriceQuantity, named Total.

So, i have this:

mygrid.setHeader(“Title, Author, Genre, Date, Price, Quantity,Total”);


and all works fine.


when i do this:


mygrid.setHeader(“Title, Author, Genre, Date, Price, Quantity,Total,City”);


doesn�t work any more.

because the data of the field ‘City’ overwrite my calculated column ‘Total’

How can i fix this?

Try to define render_table method as follow:

$grid->render_sql(“select *, ‘’ as dummy from authors”,“authors_id”,“authors_product,authors_author,authors_genre,Pub_Date,Price,Quantity,dummy,City”);

If you plan to use data saving functionality , you will need to use beforeProcessing event and delete dummy field from list of fields used in server side actions ( please inform if you need more details )