Welcome Guest, Not a member yet? Register   Sign In
delete table row without refresh page
#1

[eluser]teddy[/eluser]
I used library table of codeigniter and below is my code, but I I don't know how to delete row without refresh page, someone tell me a links tutorials or guide how to do it.

Quote: function products_list($offset=0)
{


// offset
$uri_segment = 3;
$offset = $this->uri->segment($uri_segment);

//load data
$this->load->model('products_model');
$list=$this->products_model->getPagedList($this->limit,$offset)->result();
// generate pagination
$this->load->library('pagination');
$this->load->library('table');

$config['base_url']=site_url('products/products_list');

$config['total_rows']=$this->db->get('tbl_products')->num_rows();
$config['per_page']=$this->limit;
$config['num_links']=20;
$config['uri_segment']=$uri_segment;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();

$this->table->set_empty(" ");
$tmpl=array('table_open' => '<table border="0" cellpadding="2" cellspacing="1" class="table_product">');
$this->table->set_template($tmpl);


$this->table->set_heading('No', 'Product name', 'Product cate', 'Price', 'Actions');

$i=0+$offset;
foreach($list as $l)
{

$this->table->add_row(++$i,$l->name,$l->cateid,$l->price,
anchor('products/products_list/view/'.$l->id,'view',array('class'=>'view')).' '.
anchor('products/products_list/update/'.$l->id,'update',array('class'=>'update')).' '.
anchor('products/delete/'.$l->id,'delete'
,array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this person?')"))
) ;

}

$data['table']=$this->table->generate();

$this->load->view('products_list',$data);
}


function delete($id)
{
$this->load->model('products_model');
$this->products_model->delete($id);
redirect('products/products_list/','refresh');
}

Thank you for reading my topic.



Messages In This Thread
delete table row without refresh page - by El Forum - 05-09-2012, 06:16 AM
delete table row without refresh page - by El Forum - 05-09-2012, 06:42 AM
delete table row without refresh page - by El Forum - 05-09-2012, 07:20 AM
delete table row without refresh page - by El Forum - 05-10-2012, 07:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB