0

how can I to perform this operation?

    this->datatables->select('first_name','roll_num')
    -> from('students')
    -> add_column('cancel',anchor("cancel/<first_name>/<roll_num>", 'Delete', array('onClick' =>"return confirm('Are you sure you want to delete?')")));

I need to pass first_name and roll_num for this one. How to pass these arguments into anchor.

Thanks for the help!

actually i am able to do it using ->add_column('cancel','Delete,','first_num',roll_num');

but since i want a yes/no conformation I want the above syntax .... Is there any other way to add yes/no conformation to it

Raidri
  • 17,258
  • 9
  • 62
  • 65
Rishi Reddy
  • 123
  • 1
  • 2
  • 10

1 Answers1

0

I don't think it is possible this way. You will have first to retrieve the result (as an associative array) and then call Codeigniter's anchor function on the result. Your RDBMS is totally ignorant of the anchor function.

Something that might look like this :

$query = $this->datatables->select('first_name','roll_num')
->from('students')
->get();

$results = $query->result();

anchor("cancel/{$results[0]->first_name}/{$results[0]->roll_num}", 'Delete', array('onClick' =>"return confirm('Are you sure you want to delete?')"));

I did not tried the above code, so it might have some synthax fixing, but I thinkthe general solution is there.

MaxiWheat
  • 6,133
  • 6
  • 47
  • 76