⚠ 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

setTexteditor() in multi grid



drinkingwine
  • profile picture
  • Member

Posted 17 December 2019 - 15:21 PM

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.

 

 


drinkingwine
  • profile picture
  • Member

Posted 19 December 2019 - 00:10 AM

So, console shows this.

 

Uncaught TypeError: 
$selector
.ckeditor is not a function
    at Object.texteditor (jquery-plugins.js:32)
    at RichTexteditorWithPlugin.componentDidMount (rich-texteditor-with-plugin.js:28)
    at commitLifeCycles (react.v16.2.0.js:10997)
    at commitAllLifeCycles (react.v16.2.0.js:12173)
    at HTMLUnknownElement.callCallback (react.v16.2.0.js:2265)
    at Object.invokeGuardedCallbackDev (react.v16.2.0.js:2304)
    at invokeGuardedCallback (react.v16.2.0.js:2161)
    at commitRoot (react.v16.2.0.js:12277)
    at performWorkOnRoot (react.v16.2.0.js:13244)
    at performWork (react.v16.2.0.js:13194)




texteditor: function texteditor($selector) {
$selector.ckeditor();
}

 

There is a previously unanswered question about ckeditor in multi-grids.