Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add export PDF with post as a method. #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
yajra merged 5 commits into yajra:3.0 from jiwom:export-post-pdf
Oct 27, 2017
Merged

Conversation

@jiwom
Copy link
Contributor

@jiwom jiwom commented Oct 27, 2017

Use exportPostPdf as button. This button is recommended for IE browsers since IE has URL length limit.

yajra reacted with thumbs up emoji
Copy link
Contributor Author

jiwom commented Oct 27, 2017
edited
Loading

change exportPostPdf to postPdf

sample code would be

public function html()
{
 return $this->builder()
 ->columns($this->getColumns())
 ->parameters([
 'buttons' => ['postPdf'],
 ]);
}

Take note of adding CSRF token

<meta name="csrf-token" content="{{ csrf_token() }}" />
<script type="text/javascript">
$.ajaxSetup({
 headers: {
 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
 }
});
</script>

Take note of your Routing

$router->post('sample/export', SampleController::class . '@index');

Copy link
Owner

yajra commented Oct 27, 2017

Please solve conflict / remove the same script found on #41 as it was already merged. Thanks!

Copy link
Contributor Author

jiwom commented Oct 27, 2017

Done for fixing conflict. Thanks!

var params = dt.ajax.params();
params.action = action;
params._token = $('meta[name="csrf-token"]').attr('content');
params._token = $.fn.dataTable.defaults.csrf_token;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this back to meta.

Copy link
Contributor Author

jiwom commented Oct 27, 2017

Change to $('meta[name="csrf-token"]').attr('content')

@yajra yajra merged commit 9e761a3 into yajra:3.0 Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@yajra yajra yajra left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /