Home > Enterprise >  Yii2 Kartik-v gridView widget. How to pass # from 'formatUrl' to url
Yii2 Kartik-v gridView widget. How to pass # from 'formatUrl' to url

Time:11-15

I have gridView with filter option and my need is to open specific URL after filter applies.

I am using 'filterUrl' option, but trick is there that instead of # in browser he puts out #. I am in big need that URL after apply filter includes #.

Here is start of gridView code example

    <?= GridView::widget([
      'dataProvider' => $dataProvider,
      'filterModel' => $searchModel,
      'filterUrl' => ['consignment/view','id' => '2#request'],

CodePudding user response:

If you want to add hash part to your url you have to add it as independent item in array with # as key. In your case:

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'filterUrl' => ['consignment/view','id' => '2', '#' => 'request'],
    // ... other GridView options
]); ?>
  • Related