Skip to content

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.

@jiwom
Copy link
Contributor Author

jiwom commented Oct 27, 2017

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');

@yajra
Copy link
Owner

yajra commented Oct 27, 2017

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

@jiwom
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.

@jiwom
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants