I suggest you ...

Use a different SELECT statement for Export.

In most grids I use set_col_edittype() to show values for underlying ids. When exported, only the id's are shown, not the values.

For instance, my SELECT statement would be:
"SELECT purchase_id, customer_id, article_id, amount FROM purchases"
using edittype i would set customer_id to view the customer name and article_id to view the article name.
Only when exported, the id's are exported, but the names are not.
It would be nice to have an option something like this:
$dg->set_export_sql("SELECT purchase_id, customer_name, article_name, amount FROM purchases LEFT JOIN customers USING(customer_id) LEFT JOIN articles USING(article_id)");

7 votes
Vote
Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
Douwe shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Facebook Google
Signed in as (Sign out)
Submitting...
  • Stephen Welch commented  ·   ·  Flag as inappropriate

    Just bought phpgrid and this one one of the first issues I came across - very annoying.

    To be honest it would be good to have the export as an option to export RAW data (as it does now) or export as displayed.

    My users would like "reports" showing actual words - not id's.
    But for database table issues etc to be able to export the raw data - as it does now - is great.

    Having already setup how we would like our columns displayed the export option could be enhanced to something like

    enable_export('EXCEL',RAW') ; # data as exported currently
    enable_export('EXCEL',DISPLAY) ; # data as the user sees it on their screen

Feedback and Knowledge Base