echo form_open('test/proc');
o/ l" Z |5 z0 ] U8 }/ H
echo $this->Datagrid->generate();
( c# K% I9 ]" x. v% C5 g- y1 a, w, H
echo Datagrid::createButton('delete','Delete');
# d( X. ? M H, A7 _' V2 i( k* j& f* u
echo form_close();
( z# D! t% {' P3 D3 k8 D; R5 ?
}
p: r9 ~+ D! z
function proc($request_type = ''){
$this->load->helper('url');
if($action = Datagrid::getPostAction()){
, L* y' f8 D5 }
$error = "";
switch($action){
case 'delete' :
W" B3 e) B0 N& c; y
if(!$this->Datagrid->deletePostSelection()){
6 g9 y8 s; Y. `) o5 ^
+ S5 t% E. {! c8 }; @+ M, R. q
$error = 'Items could not be deleted';
0 e! M6 K; O4 o
}
+ r0 |: u0 y9 g
break;
0 E" ]5 i- c) {7 V
- B' W8 q1 N5 ~5 W
}
2 m! n9 ?' w8 o! x* Q, @7 ^
if($request_type!='ajax'){
$this->load->library('session');
$this->session->set_flashdata('form_error',$error);
redirect('test/index');
} else {
echo json_encode(array('error' => $error));
9 N' Z% V* Z; W3 q! m% O