I load a grid from a Table, using:
$grid->render_table(“authors”,“authors_id”,“authors_product,authors_author,authors_genre,Pub_Date,Price,Quantity”);
but i want a calculated column: PriceQuantity, named Total.
So, i have this:
mygrid.setHeader(“Title, Author, Genre, Date, Price, Quantity,Total”);
mygrid.setColTypes("ed,ed,co,dhxCalendar,price,ed,ro[=c4c5]");
and all works fine.
BUT!..
when i do this:
$grid->render_table(“authors”,“authors_id”,“authors_product,authors_author,authors_genre,Pub_Date,Price,Quantity,City”);
mygrid.setHeader(“Title, Author, Genre, Date, Price, Quantity,Total,City”);
mygrid.setColTypes(“ed,ed,co,dhxCalendar,price,ed,ro[=c4*c5]”,ed);
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 )