Closed likman closed 4 years ago
I try to help leave ExportMenu.php file original and set your dataprovider parameter like this
$dataProviderA = new SqlDataProvider([
'sql' => "select * from your_table",
'params' => "",
'totalCount' => total_of_your_data_rows,
'pagination' => [
'pageSize' => 10,
'page' =>your_expected_page_start_from_zero,
],
]);
You can set pagination to false IF the app export parameter is set in your controller. This way filtering still works. I’ll post an example in a couple hours when I get to my computer.
If you do a var_dump on get and post variables it should become pretty apparent what to do
On Feb 11, 2020, at 3:16 AM, sihar notifications@github.com wrote:
I try to help leave ExportMenu.php file original and set your dataprovider parameter like this
$dataProviderA = new SqlDataProvider([ 'sql' => "select * from your_table", 'params' => "", 'totalCount' => total_of_your_data_rows, 'pagination' => [ 'pageSize' => 10, 'page' =>your_expected_page_start_from_zero, ], ]);
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
In controller before render: if(isset($_POST['export_type'])){$dataprovider->pagination = false;}
This will allow you to keep your filters
On Fri, Feb 14, 2020 at 7:07 AM Aaron Conlon aaron@geek.ninja wrote:
You can set pagination to false IF the app export parameter is set in your controller. This way filtering still works. I’ll post an example in a couple hours when I get to my computer.
If you do a var_dump on get and post variables it should become pretty apparent what to do
On Feb 11, 2020, at 3:16 AM, sihar notifications@github.com wrote:
I try to help leave ExportMenu.php file original and set your dataprovider parameter like this
$dataProviderA = new SqlDataProvider([ 'sql' => "select * from your_table", 'params' => "", 'totalCount' => total_of_your_data_rows, 'pagination' => [ 'pageSize' => 10, 'page' =>your_expected_page_start_from_zero, ], ]);
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kartik-v/yii2-export/issues/311?email_source=notifications&email_token=AA6OCQHANFVGDI7MGTY2DWDRCJNG7A5CNFSM4J2KVY6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELLRFVA#issuecomment-584520404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6OCQB2ABKLTRD56IGOQHDRCJNG7ANCNFSM4J2KVY6A .
I try to help leave ExportMenu.php file original and set your dataprovider parameter like this
$dataProviderA = new SqlDataProvider([ 'sql' => "select * from your_table", 'params' => "", 'totalCount' => total_of_your_data_rows, 'pagination' => [ 'pageSize' => 10, 'page' =>your_expected_page_start_from_zero, ], ]);
There are a few drawbacks to this solution; It's only useful for dumping the entire table, and it doesn't allow for relations, it doesn't allow for exporting the result of a search, and it requires defining an all-new data-provider. Better to just disable pagination before rendering.
Can you give example for what you mean? I think with different approach will give broader insight for us and others.
Can you give example for what you mean? I think with different approach will give broader insight for us and others.
Not sure what you mean here. Have you tried putting the line I included just before your render in your controller action?
$dataProvider = new SqlDataProvider([ 'sql' => $sql, 'params' => $params, 'totalCount' => $count, 'pagination' => false, 'attributes' => $this->attributes(), ], ]);
Sorry, seems I only focus to leave ExportMenu.php original for issue that posted. Thanks for @ThreepE0 and @aikon2 for example script. I test it and it works
I suggest this issue closed
Hello. I use Export widget with SqlDataProvider with pagination and I need to export all rows. Now widget allows me to export only one page.
Here is my code:
Widget code:
I searched the solution in ExportMenu.php file of the widget and found this code in iniExport() function:
If I disable ELSE block, code works perfectly and widget exports all rows. I tried to set "batchSize" parameter, but nothing happend. If batchSize is more than real pageSize of dataProdider, one page exports anyway. So what is a good way for export all rows without disabling that code?