⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

change the delete function to update x_status=0



Srowako

Srowako
  • profile picture
  • Member

Posted 30 October 2012 - 09:02 AM

Dear all,

there something wrong with my code:

$crud->set_table('aap_qt')
->set_subject('General Quotation')
->columns('risk_location','occupation','period','rate','discount','brokerage','deductibles','clauses','note');
$crud->unset_delete();
$crud->add_action('Delete', '', '','ui-icon-minus',array($this,'delete_status_row'));
$output=$crud ->render();
$this->_v('quotations',$output);




function delete_status_row($primary_key, $row){
$delete_status_update = array(
"status" => 0,
"user_delete" => $this->dx_auth->get_user_id(),
"time_delete" => date('Y-m-d H:i:s')
);
return $this->db->update('aap_qt',$delete_status_update,array('id' => $row));
}


Thank you for your attention.

victor

victor
  • profile picture
  • Member

Posted 30 October 2012 - 11:11 AM

Hi, Srowako and welcome to the forum.

your code don't works correctly because the function add_action returning [b]a link[/b]

victor

victor
  • profile picture
  • Member

Posted 30 October 2012 - 11:22 AM


function mamager()
{

if($this->input->get('delete'))
{

$delete_status_update = array(
"status" => 0,
"user_delete" => $this->dx_auth->get_user_id(),
"time_delete" => date('Y-m-d H:i:s')
);
$this->db->update('aap_qt',$delete_status_update,array('id' => $this->input->get('delete')));
}


$crud->set_table('aap_qt')
->set_subject('General Quotation')
->columns('risk_location','occupation','period','rate','discount','brokerage','deductibles','clauses','note');
$crud->unset_delete();

$crud->add_action('Delete', '', '','ui-icon-minus',array($this,'delete_status_row'));


$output=$crud ->render();
$this->_v('quotations',$output);
}


function delete_status_row($primary_key, $row){
return site_url('your_controller/mamager/').'?delete='.$row->id;
}

victor

victor
  • profile picture
  • Member

Posted 30 October 2012 - 13:07 PM

helped you?

Srowako

Srowako
  • profile picture
  • Member

Posted 30 October 2012 - 13:15 PM

Nice Code ..... !! B)

if($this->input->get('delete')){
$delete_status_update = array(
"status" => 9,
"user_delete" => $this->dx_auth->get_user_id(),
"time_delete" => date('Y-m-d H:i:s')
);
$this->db->update('aap_qt',$delete_status_update,array('id' => $this->input->get('delete')));
}

$crud->add_action('Delete', '', '','ui-icon-minus',array($this,'delete_status_row'));


function delete_status_row($primary_key, $row){
return site_url('quotations/index/').'?delete='.$row->id;
}


[color=#282828][font=helvetica, arial, sans-serif]Thanks Victor, it's working. :wub:[/font][/color]