I would like to run an SQL Update statement if a user clicks the Excel CSV Export Button, so I can track when the export has been ran.
Is this possible ?
Thanks
Mike
Hi,
You can try this code. $g is grid object. array 3rd index is set to true.
$e["on_export"] = array("custom_export", null, true); $g->set_events($e); // custom on_export callback function function custom_export($param) { $grid = $param["grid"]; $grid->execute_query("UPDATE ...."); }
Excellent and very straight forward, works perfectly!
Thank you for the quick response!
Mike
A follow-up question, sorry, I forgot to ask. Is there a way to pass-in the filter variables to the Function? I know how to pass parameters for add/edit, but if I Just have an inline filter for several columns for the export, can I add those filters?
Something likeĀ {$data[“params”][“filter_1”]} ?
Thanks again
Mike
You can debug $param inside the callback function, like
print_r($param); die;
$param array contains array of rows to be exported.