2012-11-30 65 views
0

我在笨開發簡單的自定義網格,我有以下的格列如何從表網格值笨

S1中 - 校驗值(複選框) - 用戶ID - 用戶名 - 電子郵件

所以,如果任何人檢查任何行並提交,我應該能夠得到選定行的值..

所以任何一個可以給我知道如何才能做到在同一笨..

   function showattendee($id, $offset=0) 
{ 
    $person = $this->Person_model->get_by_id($id)->row(); 
    $this->form_data->id = $person->tab_classid; 
    $this->form_data->classtitle = $person->tab_classtitle; 
    $this->form_data->classdate = $person->tab_classtime; 
    $this->form_data->createddate = $person->tab_crtdate; 
    $this->form_data->peremail = $person->tab_pemail; 
    $this->form_data->duration = $person->tab_classduration; 

    //Show User Grid - Attendee>>>>>>>>>>>>>>>>>>>>>>>> 
    $uri_segment = 0; 
    $offset = $this->uri->segment($uri_segment); 
    $courses = $this->Mycourses->my_courses($this->limit,$offset,$this-     >form_data->classtitle)->result(); 
    // generate pagination 
    $this->load->library('pagination'); 
    $config['base_url'] = site_url('person/index/'); 
    $config['total_rows'] = $this->Mycourses->count_all(); 
    $config['per_page'] = $this->limit; 
    $config['uri_segment'] = $uri_segment; 
    $this->pagination->initialize($config); 
    $data['pagination'] = $this->pagination->create_links(); 
    // generate table data 
    $this->load->library('table'); 
    $this->table->set_empty(" "); 
    $this->table->set_heading('Ref#','Check', 'User Id','User Name', 'Email'); 
    $i = 0 + $offset; 
    foreach ($courses as $course) 
    { 
     $checkarray=array('name'=>'chkclsid[]','id'=>'chkclsid','value'=>$course->user_id); 
     $this->table->add_row($course->mycourse_id,form_checkbox($checkarray), $course->user_id, $course->user_name, $course->user_email); 
    } 
    $data['table'] = $this->table->generate(); 

//結束電網代碼

// load view 
    // set common properties 
    $data['title'] = 'Assign Attendees'; 
    $msg = ''; 
    $data['message'] = $msg; 
    $data['action'] = site_url('person/CreateAttendees'); 
    //$data['value'] = "sssssssssssssssssss"; 
    $session_data = $this->session->userdata('logged_in'); 
    $data['username'] = "<p>Welcome:"." ".$session_data['username']. " | " . anchor('home/logout', 'Logout')." | ". "Userid :"." ".$session_data['id']; "</p>"; 
    $data['link_back'] = anchor('person/index/','Back to list of Classes',array('class'=>'back')); 
    $this->load->view('common/header',$data); 
    $this->load->view('adminmenu'); 
    $this->load->view('addattendee_v', $data); 

} 
+0

你能粘貼你的代碼嗎?並自定義網格鏈接 – GBD

回答

0

當您使用選中的複選框提交數據時,您可以通過以下方式獲取這些數據。

$obj = $this->input->post('chkclsid'); 
echo $obj['0']; 
+0

讓我現在嘗試你的代碼,我希望我會從你的解決方案中得到解決方案.... – user1811423

+0

所以你的意思是,我可以得到選定的完整的行值? – user1811423

+0

不,你會得到選定的複選框的值 – GBD