E
E
etterej2018-03-30 10:59:15
Yii
etterej, 2018-03-30 10:59:15

How to reload a div on a button with a widget inside?

I have a simple controller

public function actionIndex()
    {
        return $this->render('index');
    }

In the view inside the blocks, I call a series of widgets that draw graphs. All logic is inside widgets, they have no input parameters. In each block, I want to add a button to update the widget inside this block.
<?= Html::a("Обновить", ['???'], ['class' => 'btn btn-sm btn-default', 'data-pjax' => '#formsection']) ?>

I wrap the widget itself in pjax.
<?php Pjax::begin(['id' => 'formsection', 'linkSelector' => '#chart a']); ?>
                <div class="chart" id="chart" style="height: 200px; position: relative;">
                    <?= Chart::widget(); ?>
                </div>
                <?php Pjax::end(); ?>

Tell me how to point the button to a specific block?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question