In the public function clients_management, I have setup a setActionButton with an action of "chart".
$crud->setActionButton('Chart', 'fa fa-user', function ($row)
{ return '/index.php/clients/chart/' . $row->first_name . ' ' . $row->middle_name . ' ' . $row->last_name . ' : Account No. ' . $row->account;}, false);
Function chart defines two grids, notes and psa.
public function chart($id) {
$crud = $this->_getGroceryCrudEnterprise();
//$crud->unsetBootstrap();
$crud->setClone();
$crud->setApiUrlPath('/index.php/clients/notes/'.$id);
$output = $crud->render();
$crud2 = $this->_getGroceryCrudEnterprise();
$crud->setApiUrlPath('/index.php/clients/psa/'.$id);
$output2 = $crud->render();
$output->output .= '<br/>' . $output2->output;
$this->_client_output($output);
}
First grid, notes
public function notes($id) {
$uncode_id = urldecode($id);
$pos = strpos($uncode_id, "No.");
$account_from_string = substr($uncode_id,$pos+4);
$this->autofill_accountId = $account_from_string;
$this->autofill_updated_at = date("Y-m-d - H:m");
$this->autofill_created_at = date("Y-m-d - H:m");
$this->accountId = $id;
$crud = $this->_getGroceryCrudEnterprise();
$crud->setTexteditor(['body']);
$crud->setClone();
//$crud->unsetBootstrap();
$crud->setTable('notes');
$crud->where(['notes.account' => $account_from_string]);
$crud->setSubject('a note for ' . $uncode_id);
$crud->columns(['updated_at','title','body']);
$crud->displayAs('updated_at','Last Update')
->displayAs('title','Type of Note')
->displayAs('body','Body');
$crud->callbackAddForm(function ($data) {
$data['account'] = $this->autofill_accountId;
$data['created_at'] = $this->autofill_created_at;
$data['updated_at'] = $this->autofill_updated_at;
return $data;});
$output = $crud->render();
$this->_client_output($output);
}
When i add or edit a record, with setTexteditor set, the form does nothing. Clicking on add or edit just keeps the same grid up.
Any ideas?
Do I have to use some callback function?
Thanks in advance.