Effect Display:
Code implementation:
Controller
<?php namespace App\controllers;
Use Yii;
Use Yii\filters\accesscontrol;
Use Yii\web\controller;
Use Yii\filters\verbfilter;
Use App\models\loginform;
Use App\models\contactform;
Use Yii\db\activerecord;
Use yii\data\pagination;
Use App\models\ecsgoods;
Class Pagecontroller extends Controller {//public $layout =false;
Show, paging public function actionlist () {$query = Ecsgoods::find ();
$pagination = new Pagination ([' Defaultpagesize ' => 5, ' totalcount ' => $query->count (),]);
$countries = $query->offset ($pagination->offset)->limit ($pagination->limit)->all ();
return $this->render (' list ', [' Brr ' => $countries, ' pagination ' => $pagination,]);
///point to change Public function actionupdates () {$request = Yii:: $app->request;
$id = $request->get (' old_id ');
$name = $request->get (' Old_val ');
$connection =yii:: $app->db; $command = $connection->createcommand ("Update ecs_goods set goods_name= ' $name ' where goods_iD= ' $id ');
$re = $command->execute ();
if ($re) {echo 1;
//Single Delete public function Actiondel () {$request = Yii:: $app->request;
$id = $request->get (' IDs ');
$connection =yii:: $app->db;
$command = $connection->createcommand ("Delete from ecs_goods where goods_id= ' $id ')";
$re = $command->execute ();
if ($re) {echo 1;
else {echo 0;
}///batch Delete public function Actionalldel () {$request = Yii:: $app->request;
$id = $request->get (' new_str ');
$connection =yii:: $app->db;
$command = $connection->createcommand ("Delete from Ecs_goods where goods_id in ($id)");
$re = $command->execute ();
if ($re) {echo 1;
else {echo 0;
}} The view layer [HTML] view plain copy on the code to see that a piece of coding is derived to my Code slice <?php use yii\helpers\html;
Use Yii\widgets\linkpager; ?> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
The above is a small set of JavaScript to introduce all of the selected, all do not select, reverse, no refresh delete, bulk Delete, that is, the point is to change warehousing (operation in the YII framework) of the code to share, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!