Skip to content
Advertisement

Yii2 Kartik-v gridView widget. How to pass # from ‘formatUrl’ to url

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 %23. 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'],

Advertisement

Answer

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
]); ?>
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement