Hi Folks,
Is it possible to identify which columns are currently visible/selected via columns chooser toolbar icon for use within a customer CSV export function?
Many Thanks.
Hi,
You can check this variable: $_REQUEST[“jqgrid_colchooser_list1“]); in custom export callback. It contains comma separated column names. (here list1 is grid id you set in render function)
You can then refer demo code: http://phpgrid.org/demo/demos/export/export-custom.phps Line 149 and skip/add them in export.
Thanks for the feedback. If I output $_REQUEST from the callback it doesn’t appear to contain any column info:
$_REQUEST = Array ( [grid_id] => list1 [export] => 1 [jqgrid_page] => 1 [export_type] => [sidx] => 1 [sord] => asc [rows] => 20 [_search] => )
jqgrid_dist.php appears to merge the the $_REQUEST and $_COOKIE arrays before searching for fields to exclude, so if I look in our $_COOKIE arrays I can see the colchooser parameter.
$_COOKIE = Array ( [jqgrid_colchooser_list1] => department,deviceType,make,model, …
Unfortunately that cookie appears to be shared across pages and retains the last colchooser used, so if I then visit another phpgrid page on our site (or even reload the current page) that out of date column list would result in the export function trying to output those fields instead of what’s shown on screen!
Should my $_REQUEST definitely contain that value? We’re running phpGrid v2.6. Is there any other way to pull the active list of columns? If not, could you please consider this feature for a future version?
Many Thanks.