CodeIgniter is a small but powerful PHP framework that can be used as a simple and "elegant" toolkit to build a full-featured WEB application for developers. is a more mainstream PHP framework.
Here is a description of the CI framework (Ajax paging, select all, reverse, not select, bulk Delete) complete code, the specific code is as follows:
Ajax Paging + search (view layer) function Ajax_page (page) {var sou = $ (' #sou '). Val (); $.ajax ({type: "POST", DataType: "json", url: "< ?
PHP echo site_url (' welcome/ajax_page ')?> ", Data:" page= "+page+" &sou= "+sou, success:function (data) {var str=" ";
str+= "<table border= ' 1 ' style= ' text-align:center ' >";
str+= "<tr>";
str+= "<td><input type= ' checkbox ' class= ' Quan '/></td> ';
str+= "<td>ID</td>";
str+= "<td> user name </td>";
str+= "<td> operation </td>";
str+= "</tr>"; $.each (Data.list,function (I,item) {if (item.state==0) {var locks = "<a href= ' javascript:void (0) ' class= ' Lok '" fla= ' "+ item.id+ "' id= ' lock" +item.id+ "' > Unlocked </a>"}else{var locks = "<a href= ' javascript:void (0) ' class= ' Lok ' fla= '
"+item.id+" ' id= ' Lock ' +item.id+ ' > Lock </a> '} str+= ' <tr id= ' av ' +item.id+ ' > ';
str+= "<td><input type= ' checkbox ' class= ' ss ' value= '" +item.id+ "'/></td> ';
str+= "<td>" +item.id+ "</td>"; str+= "<td>" +item.name+ "≪/td> ";
str+= "<td>" +locks+ "</td>";
str+= "</tr>";
}) str+= "<tr>";
str+= "<td><input type= ' button ' id= ' Pdel ' value= ' bulk delete ' ></td>" str+= "</tr>";
str+= "</table>";
STR+=DATA.PAGESTR;
$ (' #content '). html (str); }}//Status toggle $ (document). On (' click ', '. Lok ', function () {var id = $ (this). ATTR (' fla '); $.ajax ({type: "POST", url: "<?ph P Echo site_url (' Welcome/upds ')?> ", Data:" Id= "+id, Success:function (msg) {if (msg==1) {$ (' #lock ' +id). HTML (" locked ");
else{$ (' #lock ' +id). HTML ("unlocked"); })//Bulk deletion of $ (document). On (' Click ', ' #pdel ', function () {var ids = $ ('. SS '); var str= ""; $.each (Ids,function (I,item) {if (i)
ds[i].checked==true) {str=str+ ', ' +ids[i].value}} ')
var new_str=str.substr (1); $.ajax ({type: "POST", url: "<?php echo site_url (' welcome/pdels ')?>", Data: "New_str=" +new_str, Success:function (
msg) {$.each (Ids,function (I,item) {if (ids[i].checked==true) {$ (' #av ' +ids[i].value). Remove ();}}}}) })//Select all (check box) $ (document). On (' click ', '. QUan ', function () {var obj = $ (': CheckBox '); var ids = $ ('. SS '); if (obj[0].checked==true) {$.each (Ids,function (i,item) {IDs
[I].checked=true;
})}else{$.each (ids,function (i,item) {ids[i].checked=false;})}) <td><input type= "checkbox" class= "Checks" value= "<?php echo $val [' u_id ']?>]/></td>//Select All (Button) $ ('. Quan '). Click (function () {var ids = $ (' Input:checkbox '); $.each (Ids,function (i,item) {ids[i].checked=true;})})// All do not select $ ('. Bu '). Click (function () {var ids = $ (' Input:checkbox '); $.each (Ids,function (i,item) {ids[i].checked=false;})})/ /reverse $ ('. Fan '). Click (function () {var ids = $ ('. checks '); $.each (Ids,function (i,item) {ids[i].checked=!ids[i].checked;})} )//Is changed $ (document). On (' click ', '. SS ', function () {var id = $ (this). attr (' id '); var con = $ (this). text (); $ (this). Parent ()
. html ("<input type= ' text ' id= '" "+id+" ' class= ' AA ' value= ' "+con+ '" ' > ");
$ ('. AA '). Val ('). focus (). val (con); $ (document). On (' Blur ', '. AA ', function () {var id = $ (this). attr (' id '); var cons = $ (This). Val ();
$ (this). Parent (). HTML ("<span id= '" +id+ "' class= ' ss ' >" +cons+ "</span>"); $.ajax ({type: "POST", url: "<?php echo site_url (' Welcome/upd_ji ')?>", Data: "id=" +id+ "&cons=" +cons})})//guide Out $ (document). On (' Click ', ' #chu ', function () {var sou = $ (' #sou '). Val (); location.href= "<?php Echo site_url (' excel/
Export ')? >?sou= "+sou; //ajax Paging (control layer) public function ajax_page () {$sou = $this->input->post (' sou '); $count = $this->db->where ("
Name like '% $sou% ']->count_all_results ("Peng");
$number = 3;
$this->session->set_userdata (' number ', $number);
$pagecount = Ceil ($count/$number);
@ $page = $_post[' page ']?$_post[' page ']:1;
$this->session->set_userdata (' page ', $page);
$start = ($page-1) * $NUMBER; $arr [' list '] = $this->db->where ("name like '% $sou% '")->limit ($number, $start)->get ("Peng")->result_
Array ();
$up _page = $page -1<1?1: $page-1;
$down _page = $page +1> $pagecount? $pagecount: $page +1;
$str = ""; $str. = "<a href= ' JavascriPt:void (0) ' onclick= ' Ajax_page ($up _page) ' > Prev </a> '; For ($i =1 $i <= $pagecount $i + +) {if ($i = = $page) {$str. = "--". "
<b> $i </b> "; }else{$str. = "--". "
<a href= ' javascript:void (0) ' onclick= ' Ajax_page ($i) ' > $i </a> '; }} $str. = "--".
<a href= ' javascript:void (0) ' onclick= ' Ajax_page ($down _page) ' > Next </a> ';
$arr [' pagestr '] = $str;
echo Json_encode ($arr); //State Toggle Public Function Upds () {$id = $this->input->post (' id '); $arr = $this->db->get_where ("Peng", "id=" $
Id ' ")->row_array (); if ($arr [' state ']==0] {$data [' state ']=1; $this->db->where ("id= ' $id '")->update ("Peng", $data); echo "1";}
else{$data [' state ']=0; $this->db->where ("id= ' $id '")->update ("Peng", $data); echo "2";} Bulk Delete public Function pdels () {$str = $this->input->post (' New_str '), $this->db->where ("ID in ($STR)")->
Delete ("Peng"); }
The above is a small set to introduce the CI framework (Ajax paging, select all, reverse, do not select, bulk Delete) complete code, 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!