コード例 #1
0
 /**
  * Lists all Branches models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new BranchesSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     //var_dump($dataProvider);
     //die;
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
コード例 #2
0
 /**
  * Lists all Branches models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new BranchesSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $branch_id = Yii::$app->request->post('editableKey');
         $branch = Branches::findOne($branch_id);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Branches']);
         $post['Branches'] = $posted;
         if ($branch->load($post)) {
             $branch->save();
             $output = 'my value';
         }
         echo $out;
         return;
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }