grid = $grid; } /** * Set up script for export button. */ protected function setUpScripts() { $script = <<grid->getExportSelectedName()}').click(function (e) { e.preventDefault(); var rows = {$this->grid->getSelectedRowsName()}().join(','); if (!rows) { return false; } var href = $(this).attr('href').replace('__rows__', rows); location.href = href; }); JS; Admin::script($script); } /** * @return string|void */ protected function renderExportAll() { if (! $this->grid->getExporter()->option('show_export_all')) { return; } $all = trans('admin.all'); return "
  • grid->getExportUrl('all')}\" target=\"_blank\">{$all}
  • "; } /** * @return string */ protected function renderExportCurrentPage() { if (! $this->grid->getExporter()->option('show_export_current_page')) { return; } $page = $this->grid->model()->getCurrentPage() ?: 1; $currentPage = trans('admin.current_page'); return "
  • grid->getExportUrl('page', $page)}\" target=\"_blank\">{$currentPage}
  • "; } /** * @return string|void */ protected function renderExportSelectedRows() { if ( ! $this->grid->option('show_row_selector') || ! $this->grid->getExporter()->option('show_export_selected_rows') ) { return; } $selectedRows = trans('admin.selected_rows'); return "
  • grid->getExportUrl('selected', '__rows__')}\" target=\"_blank\" class='{$this->grid->getExportSelectedName()}'>{$selectedRows}
  • "; } /** * Render Export button. * * @return string */ public function render() { $this->setUpScripts(); $export = trans('admin.export'); return << EOT; } }