⚠ 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

Multi Grid (I don't understand it.)



nunenthal
  • profile picture
  • Member

Posted 03 March 2019 - 17:59 PM

Hello,
I try to display multigrid, first a just one field editing table without add or delete, and second a little table width price.
I know that is not the right way, I use CodeIgniter, and I don't understand how to use setApiUrlPath()
It's not clear for me.
Strangely, my functions tarifs display two times the first grid...
I think my function is clear to explain my need even if it's not the right way.
 
Thank's for your help.

 

 
public function tarifs()
        {
        if ($this->session->aut != 1) exit;
        $crud = $this->_getGroceryCrudEnterprise();
$crud->setTable('texte_tarif');
$crud->setSubject('Tarifs','Tarifs');
$crud->setLanguage('French');
$crud->unsetPrint();
$crud->unsetExport();
$crud->unsetDelete();
$crud->unsetDeleteMultiple();
        $crud->unsetAdd();
        $crud->unsetSearchColumns(['texte', 'texte_en']);
        $crud->columns(['texte', 'texte_en']);
        $crud->where([ 'id = ?' => 1]);
        $output = $crud->render();
        $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
        $this->_admin_output($output);
        // ***************************************
        $crud2 = $this->_getGroceryCrudEnterprise();
$crud2->setTable('tarifs');
    $crud2->setLanguage('French');
$crud2->unsetPrint();
$crud2->unsetExport();
        $crud2->columns(['titre', 'texte']);
        $crud2->setFieldUpload('photo', $_SERVER['DOCUMENT_ROOT'].'/assets/images/tarifs','/assets/images/tarifs');
        $crud2->setTexteditor(["texte"]);
        $crud2->setTexteditor(["texte_en"]);
        $crud2->callbackAfterUpload(function ($data = null) {
            $nom=$data->filename;
            $path=$data->filePath;
            $config['image_library'] = 'gd2';
            $config['source_image'] = $path;
            $config['create_thumb'] = FALSE;
            $config['maintain_ratio'] = TRUE;
            $config['width']         = 200;
            //$config['height']       = 50;
            $this->load->library('image_lib', $config);
            $this->image_lib->resize();
            return $data;
});
        $output2 = $crud2->render();
        $this->_admin_output($output2);
        $this->_footer_admin_output($output2);
        }

 


nunenthal
  • profile picture
  • Member

Posted 03 March 2019 - 20:45 PM

I trying to adapt the complete for CI sample in documentation.

The 2 grids are correctly displayed, but the add button in the second grid don't work.

 

public function tarifs()
        {
            $crud = $this->_getGroceryCrudEnterprise();
            $crud->setApiUrlPath('/admin/tarif_text');
            $output = $crud->render();
 
            $crud2 = $this->_getGroceryCrudEnterprise();
            $crud2->setApiUrlPath('/admin/tarif_tarif');
            $output2 = $crud2->render();
            
            $output->output .= '<br/>' . $output2->output;
            
        $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
        $this->_admin_output($output);
        $this->_footer_admin_output($output);
    }
        public function tarif_text()
        {
        if ($this->session->aut != 1) exit;
        $crud = $this->_getGroceryCrudEnterprise();
$crud->setTable('texte_tarif');
$crud->setSubject('Tarifs','Tarifs');
$crud->setLanguage('French');
$crud->unsetPrint();
$crud->unsetExport();
$crud->unsetDelete();
$crud->unsetDeleteMultiple();
        $crud->unsetAdd();
        $crud->unsetSearchColumns(['texte', 'texte_en']);
        $crud->columns(['texte', 'texte_en']);
        $crud->where([ 'id = ?' => 1]);
        $output = $crud->render();
        $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
       $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
        $this->_admin_output($output);
        $this->_footer_admin_output($output);
       
        }
        public function tarif_tarif()
        {
        $crud = $this->_getGroceryCrudEnterprise();
$crud->setTable('tarifs');
    $crud->setLanguage('French');
$crud->unsetPrint();
$crud->unsetExport();
        $crud->columns(['titre', 'texte']);
        $crud->setFieldUpload('photo', $_SERVER['DOCUMENT_ROOT'].'/assets/images/tarifs','/assets/images/tarifs');
        $crud->setTexteditor(["texte"]);
        $crud->setTexteditor(["texte_en"]);
        $crud->callbackAfterUpload(function ($data = null) {
            $nom=$data->filename;
            $path=$data->filePath;
            $config['image_library'] = 'gd2';
            $config['source_image'] = $path;
            $config['create_thumb'] = FALSE;
            $config['maintain_ratio'] = TRUE;
            $config['width']         = 200;
            //$config['height']       = 50;
            $this->load->library('image_lib', $config);
            $this->image_lib->resize();
            return $data;
});
        $output = $crud->render();
        $this->_header_admin_output($output);
        $this->load->view('admin_menu_v');
        $this->_admin_output($output);
        $this->_footer_admin_output($output);
        }

 


nunenthal
  • profile picture
  • Member

Posted 04 March 2019 - 09:47 AM

The Auto Increment ID was missing. But this was not the problem.

Now The first grid is ok llike a charm. In the second grid only the delete a row function is working. I can't edit or add a row. Very strange.

If I call just my controller /admin/tarif_tarif which is in fact my second grid in the page, when he is alone there is no problem.

 

Please help.


nunenthal
  • profile picture
  • Member

Posted 04 March 2019 - 10:04 AM

Finally, I find where is the problem.

It's a problem between setTexteditor() and the multigrid view function. It seem that there is a problem width the react library.

If I comment my 2 line width setTexteditor() the 2 grid are ok. 

 

I will send a mail to John, hope a solution soon.


nunenthal
  • profile picture
  • Member

Posted 07 March 2019 - 14:31 PM

Finally thank's to john, there is a workaround,

 

Simply add :

 $crud->setTexteditor(["texte"]);

in the first function, in my case in tarifs().

This do nothings, it's only for the initial load of some main libraries.