Spliting the url between two gridviews

Hello everyone,

I have two controller Project and Task, in my index page related to project controller i need to view two gridviews, one for my project and other for task, now the case is when i press on view button for project gridview it shows me the project but for task it redirected to another localhost page, even though i set up the "urlCreator" in my task gridview.

This is the code:


<?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],


            'project_name',

            'project_detials:ntext',


            ['class' => 'yii\grid\ActionColumn'],

        ],

    ]); ?>


    <?= GridView::widget([

        'dataProvider' => $dataProvider2,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],


            'task_name',

            'task_start',

            'task_end',

            'task_period',


            [

            'class' => 'yii\grid\ActionColumn',

            'urlCreator' => function($action, $model, $key, $index){

                    if($action === 'view'){

                        $url = '/task/view?id=' . $model->task_id;

                        return $url;

                    }

                },

            ],

        ],

    ]); ?>

I would like to know my issue here, thank you so much and have a great day.

It is much simpler:


[

 'class' => 'yii\grid\ActionColumn',

 'controller' => 'task',

]

Thank you so much yiim for the simplicity :D