grid = $grid; } /** * Set up script for export button. */ protected function setUpScripts() { $script = <<grid->exportSelectedName()}').click(function (e) { e.preventDefault(); var rows = LA.grid.selected('{$this->grid->getName()}').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->exporter()->option('show_export_all')) { return; } $all = trans('admin.all'); return "
  • grid->exportUrl('all')}\" target=\"_blank\">{$all}
  • "; } /** * @return string */ protected function renderExportCurrentPage() { if (! $this->grid->exporter()->option('show_export_current_page')) { return; } $page = $this->grid->model()->getCurrentPage() ?: 1; $currentPage = trans('admin.current_page'); return "
  • grid->exportUrl('page', $page)}\" target=\"_blank\">{$currentPage}
  • "; } /** * @return string|void */ protected function renderExportSelectedRows() { if ( ! $this->grid->option('show_row_selector') || ! $this->grid->exporter()->option('show_export_selected_rows') ) { return; } $selectedRows = trans('admin.selected_rows'); return "
  • grid->exportUrl('selected', '__rows__')}\" target=\"_blank\" class='{$this->grid->exportSelectedName()}'>{$selectedRows}
  • "; } /** * Render Export button. * * @return string */ public function render() { $this->setUpScripts(); $export = trans('admin.export'); return << EOT; } }