Hi,
I have two questions on the same topic that might contradict one another.
I have a grouped grid that is built from a M-to-M relationship – when I go to update a row, it tries to enter the grouped column (which is not from the table that I want to update). All I want is to have the Grouped Column be added as an FK to the main entry?
I'm guessing I need to do custom queries here on the save?
In addition, on my update (or even my add), the column that I have grouped by, is there a way in the ADD operation for me to default to the group and not let people select anything else?
Thanks – Greg
If your main table has FK column (my_fk_col), then you can have on_update event handler and set the value of that particular column in php code.
$e["on_update"] = array("update_client", null, true);
$grid->set_events($e);
function update_client($data)
{
$data["params"]["my_fk_col"] = "my default value";
}
This way, each time you update, the default value will be set in update sql.
Similar process can be used for add. Refer event handler sample code from docs.
In case of issue, you can always email me code for review.