A
A
asferot2018-12-10 16:39:16
Yii
asferot, 2018-12-10 16:39:16

How to display full list in yii2/kartik-export?

I put the yii2 / kartik-export module on the block and this plugin should print all positions on this block, but it has pagination on pages and the plugin takes only those positions that are on one page. That is, if there are 7 points on the first page - it prints 7, then you switch to another page, where there is 1 position - it prints one. And I need to display the entire list. how can it be defeated?
Controller:

$query = Orders_list::find();
$pages = new Pagination(['totalCount' => $query->count(), 'pageSize' => 7]);
$posts = $query->offset($pages->offset)
        ->limit($pages->limit)
        ->all();
$dataProvider = new ActiveDataProvider(
        [
            'query' => $query,
            'pagination' => false
        ]);

View:
<?php $gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'Invoice',
    'Date',
    'Confirm',
    ['attribute'=>'Sum','format'=>['decimal',2], 'width'=>'210px'],
    ['attribute'=>'Paid','format'=>['decimal',2], 'width'=>'210px'],
    'Ready_date',
    'Ship_date',
    'Who_ship',
    ['class' => 'yii\grid\ActionColumn'],
];
echo ExportMenu::widget([
    'dataProvider' => $dataProvider,
    'columns' => $gridColumns,
    'dropdownOptions' => [
      'label' => 'Export order list',
      'class' => 'btn btn-secondary'
    ],
    'exportConfig' => [
      ExportMenu::FORMAT_TEXT => false,
      ExportMenu::FORMAT_HTML => false,
      ExportMenu::FORMAT_CSV => false,
    ]
]);
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-12-10
@asferot

It takes data from $dataProvider, pass data there without pagination and all
1 $dataProvider for gridView, another for export
BUT!!! This is not the right decision. It is better to have a separate show all button that displays without pagination. In order not to constantly drag the entire set where it is not needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question