That was my question was for error i was getting but here i already have explained a trick to how to insert in two table and also using json like it you have a table, and now i would creating a popup for print :P
This is my view
the table is as jdata
[attachment=1045:Untitled.png]
Sorry It was My Mistake using dual jQuery different versions
I have an issue i have created an extra hidden field in the form in which i put the receipt values items as json after Save click i receive those in insert into the other table and unset(post_array['jdata']) and return the post array but after this i get the view which is in the attachments:[attachment=1044:error.png]
i don't know how to resolve it and my code is bellow
public function index() { $crud = new grocery_CRUD(); //$crud->set_theme('metro_blue'); $Ol=$this->session->userdata('outlet_id'); $crud->where('fee_payments.outlet_id',intval($Ol)); $crud->set_table('fee_payments'); $crud->field_type('outlet_id', 'hidden', '$Ol'); $crud->unset_columns('outlet_id'); $crud->fields('jdata','student_id','Recipt','total_amount','total_discount','paid_amount','date','of_month','outlet_id'); $crud->field_type('outlet_id', 'hidden', $Ol); $crud->callback_add_field('Recipt',array($this,'add_field_callback_1')); $crud->field_type('jdata', 'hidden','abc' ); $crud->callback_before_insert(array($this,'insertRecipt_callback')); $output = $crud->render(); $output->title="Fee"; $output->menuActive="Fee"; $this->_example_output($output); } public function insertRecipt_callback($post_array){ $obj1=json_decode($post_array['jdata']); foreach($obj1 as $key=>$value){ $value->discount=$value->percent_discount; unset($value->percent_discount); unset($value->student_id); unset($value->code); unset($value->paid_amount); } $this->admin_model->batch_insert("fee_recipts",$obj1); unset($post_array['jdata']); return $post_array; }
i create the jdata by using ajax