Is it possible to make an anchor when you redirect in PHP?

0 like 0 dislike
6 views
I have a table in this row are data-key="11" where 11 is the id in the database.
Redirect looks like this: return $this->redirect(['todoist/index', 'id' => $model->id_zakaz]); But since I have no page with nowhere to return task by id, so I want him to be redirected to the task page and the anchor moved on to the row of the table.
How can I add another anchor to data-key="11" :?
If I like the Chinese explained ask). Thank you.

5ae47479129fa907869170.png
by | 6 views

2 Answers

0 like 0 dislike
Good evening.
Approximately so
return $this->redirect(['index', '#' => 'custom-order-form']);

Go to the index page,

PS
For lines specify the id parameter, which will contain the record id in the database. Let it be a column "id" in the GridView table though so the value may be specified for any cell.
[ 'attribute' => 'id', 'headerOptions' => ['class' => 'head-id-column'], 'contentOptions' => function($model){ return ['id' => 'test-' . $model->id]; } ],

Further, in the controller prescribes the redirect with the desired parameter.
return $this->redirect(['index', '#' => 'test-' . $id]);

All the "anchor" is ready.

P. S. S
Or. 'Don't do 'contentOptions', and make 'rowOptions'.
GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function($model){ return ['id' => 'test-' . $model->id]; }, 'columns' => [ // rest of code ], ]);
by
0 like 0 dislike
can
but IMHO easier to use
header("Location: http://www.example.com/#44"); /* Redirect browser */

than to understand other people's classes
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Jun 5, 2019 by Leshiy66613
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,672 users