I
I
ITwoolf2019-03-18 09:53:29
Yii
ITwoolf, 2019-03-18 09:53:29

How to add an import button to DynaGrid?

Good afternoon. Such a small problem. I added a DynaGrid to myself and now my table has an export property in the scv file. I need to add a file export button with the same format next to it. I wrote the necessary code in the controller to import files. Now I need to create a button on my table that I created with DynaGrid and bind it to a controller to make it work. I could of course do things like the "export" button that came with DynaGrid. But the bottom line is that there is no export property in the DynaGrid code. Help me please.
Actually, here is the DynaGrid code itself

echo DynaGrid::widget([
    'columns'=>$columns,
    'storage'=>DynaGrid::TYPE_COOKIE,
    'theme'=>'panel-danger',
    'gridOptions'=>[
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'panel'=>['heading'=>'<h3 class="panel-title">Library</h3>'],
    ],
    'options'=>['id'=>'dynagrid-1'] // a unique identifier is important
]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2019-03-18
@ITwoolf

According to the documentation it looks like this:

'gridOptions'=>[
        'dataProvider'=>$dataProvider,
        'filterModel'=>$searchModel,
        'showPageSummary'=>true,
        'panel'=>[
            'heading'=>'<h3 class="panel-title"><i class="glyphicon glyphicon-book">  Library',
            'before'=>'{dynagrid}' . Html::a('Custom Button', '#', ['class'=>'btn btn-default'])
        ],
    ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question