I have 2 tables for contacts. One is the "main" one with the primary data (eg ID, Name, Email). I want to display this in the grid (with inline editing). This works well. But I want to generate a simple dialog (as in the Dialog Layout demo) that shows a popup dialog containing the fields from the "details" table (eg ID, address, phone, website, etc).
Seems like this is possible, but it's not clear to me what the syntax would be. Any and all help appreciated. Thanks!
If you want view only dialog:
You can use select_command to have a join query of both tables and select all fields as grid columns.
You can hide / show certain grid column on list view and view dialog using following code:
$col["show"]["list"] = true;
$col["show"]["view"] = false;
If you want them in edit dialog and change them on editing, you will follow the same join query work as above but on edit you need to bind on_update event handler.
In that callback function you can override the default edit behavior of grid and run 2 queries based on posted data.
For details, refer demos/editing/custom-events.php
Thanks for the quick response – that is a good suggestion. I was stuck thinking there would be a way to have 2 queries in one instance of the grid. Silly.
However, I am getting a not so helpful error message. It displays an empty grid with an error dialog:
Query is Select booking.cal_calendar.event_date , booking.cal_events.name, booking.cal_events.description from booking.cal_calendar join booking.cal_events on booking.cal_calendar.event_id = booking.cal_events.id where booking.cal_calendar.event_date > "201711"
{"page":1,"total":1,"records":"3","rows":[{"event_date":"2017-02-16","name":"Duke Performances Presents Talib Kweli","description":""},{"event_date":"2017-02-17","name":"Duke Performances Presents Talib Kweli","description":""},{"event_date":"2017-03-26","name":"An Evening with Loudon Wainwright III","description":""}]}
Seems as though we have all the data we need to fill the grid. There's no actual Error presented, just the query and the results. I've tried with "inner join" and just "join" with the same results.
Any suggestions on how to get more info on what is going wrong?
Hi,
I think all you need now is to comment out the echo / print debug calls.
Its basically breaking the JSON due to query output before json data.