Problems with the use of GridView:: widget and SqlDataProvider

I need help

the model gives error

The value obtained is the last of the query and not the row positioned

//$url = ‘/trata_inq/web/index.php?r=resultado/seg?iano=’. $dataProvider l[‘regiao’]; (gives error)

-> resultado is controller and seg is function actionSeg()

-> does not interpret the function

I need to press the button on a line and send the values iano and actionSeg function region () on the controller resultadosController "


Code view: 


use yii\helpers\Html;

use yii\grid\GridView;

use yii\web\Controller;


<?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        //‘model’ => $dataProvider,    (erro)	


       'columns' => [

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

['label' => 'Ano','format' => 'raw','value' => 'iano'],

	['label' => 'Regiao','format' => 'raw','value' => 'regiao'],

            		

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

		'template' => '{segmento}',

		'buttons' => [

//'segmento' => function ($url, $model) {

		           'segmento' => function ($url, $dataProvider) {

		            	     return Html::a('<span class="fa fa-search"></span>Seg', $url, [

               			'title' => Yii::t('app', 'Por Segmento'),

				'class'=>'btn btn-primary btn-xs',                                  

			    ]);

            		         },

        		],

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

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


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

						


			//$url = '/trata_inq/web/index.php?r=resultado/seg?iano='. $dataProvider l['regiao']; (error) 

			// Note: resultado is controller and seg is function actionSeg()

			




                		$url = '/trata_inq/web/index.php?r=resultado/seg';


			//$_SESSION['regiao'] = $model['regiao'] ;	 (error) 


			$_SESSION['regiao'] = $dataProvider l['regiao'] ;

			//But, The value obtained is the last of the query and not the row positioned	 





		                return $url;

     		}

	} 

	], 

    ],	

    ]); ?>


</div> 


Code Controller:

public function actionSeg()

{

		

return $_SESSION['regiao'];

		

		

$searchModel = new RelsegSearch();

$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

	

	return $this->render("_viewSegmento",array(

	    'searchModel' => $searchModel,

            'dataProvider' => $dataProvider,

		

	));

        

}

Thank you

Pereira

resolution





$url = '/trata_inq/web/index.php?r=resultado/seg&regiao='.$dataProvider['regiao'];