javascript - How to get value of checked gridview column -


hi guys have gridview below , want 'user_id' of checked column how can that???

i checked column id dont know how data of checked column in gridview want via javascript can pass service

<?= gridview::widget([         'dataprovider' => $dataprovider,         'filtermodel' => $searchmodel,         'showonempty'=>true,         'columns' => [             ['class' => 'yii\grid\checkboxcolumn'],             [                  'attribute' => 'event_id',                 'label' => 'event title',                 'value' => 'event.title'             ],             [                 'attribute' => 'user_id',                 'label' => 'email',                 'value' => 'users.email',             ],             'user_type',         ],     ]);  ?> 

and here javascript ids of checked column

jquery(document).ready(function() { btncheck  = $("#send"); btncheck.click(function() {     var keys = $("#w0").yiigridview("getselectedrows");   } }); 

let me tell flow of this

on homepage gridview enter image description here user click on small user sign , open page can see below

thats when want send messages selected users

enter image description here because in case title different table , name , email different table want ids of user table

for want user_id getting random values can here???

i tried returning random string

public function search($params) {      if(!isset($_get['id'])){         $id='';     }     else{         $id=$_get['id'];     }      $query = checkin::find()->where(['event_id'=> $id]);      $query->joinwith(['event', 'users']);      $dataprovider = new activedataprovider([         'query' => $query,     ]);      $this->load($params);      if (!$this->validate()) {         return $dataprovider;     }      $query->andfilterwhere([         'id' => $this->id,         'created_date' => $this->created_date,         'created_by' => $this->created_by,         'updated_date' => $this->updated_date,         'updated_by' => $this->updated_by,     ]);      $query->andfilterwhere(['like', 'user.email', $this->user_id]);     $query->andfilterwhere(['like', 'user_type', $this->user_type]);      $dataprovider->keys ='user_id';      return $dataprovider; } 

update dataprovider set $dataprovider->keys ='userid' able keys of user_id

data-id of gridview , allselectedcolumns


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -