⚠ 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

Export with relations not showing data



arve

arve
  • profile picture
  • Member

Posted 05 September 2017 - 12:38 PM

Hi everyone, 

 

When I do a export, I only see the ID and not the data in the export file from Excel. 

 

All the code and the CRUD is working just fine, only the export excel file that doesn't work. 

 

Any ideas?

 

Thanks. 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 September 2017 - 04:39 AM

Can you share the code that you using in the controller ...

cuz i just cross checked this example on the site itself..

https://www.grocerycrud.com/examples/set_a_relation

and if you notice there - the export dose get the office names rather then office ids. 

I am sure you might have put it under certain criteria like listing or so and hence you might have issues generating the export with relation data.

 

Also, please share in - what version of GC you are using for the same.

Once you share the code, will be able to guide you to a possible solution apart from just assuming. 

 

Happy GCIng :)


arve

arve
  • profile picture
  • Member

Posted 06 September 2017 - 06:15 AM

Hi, 

 

I'm using CI 3.1.5 with GC Enterprise 2.3.2. 

    public function computers() {
        //Setting variable and loading library.
        $crud = $this->_getGroceryCrudEnterprise();

        $crud->setTable('tbl_datasys_computers');
        $crud->setSubject('Computers');

        $crud->displayAs('computer_hostname', 'Hostname');
        $crud->displayAs('computer_sn', 'SN');
        $crud->displayAs('computer_brand', 'Brand');
        $crud->displayAs('computer_model', 'Model');
        $crud->displayAs('computer_employee', 'User');
        $crud->displayAs('computer_vendor', 'Vendor');
        $crud->displayAs('computer_comment', 'Comment');

        //Unsetting columns that are not for the regular CRUD
        $crud->unsetColumns(['computer_id', 'computer_ram', 'computer_cpu', 'computer_warranty', 'computer_mac_wlan', 'computer_mac_lan', 'computer_windows_license', 'computer_hdd', 'computer_bought_date']);
        $crud->setRelation('computer_employee', 'tbl_employees', '{employee_lastname}, {employee_firstname}');
        $crud->setRelation('computer_brand', 'tbl_datasys_brands', 'brand_name');
        $crud->setRelation('computer_vendor', 'tbl_datasys_vendors', 'vendor_name');
        
        //Setting order_by
        $crud->defaultOrdering('computer_hostname', 'asc');

        //Redering and sending data to view.
        $output = $crud->render();
        $this->_crud_output($output);
    }

The export is using ID's but at print its correct.. Hmm.. 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 06 September 2017 - 12:13 PM

OOhh ... well the Community Edition dose have proper working 

Sorry .. am not aware of the bug in the enterprise edition


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 08 September 2017 - 03:20 AM

Hello guys,

 

This is a bug at the enterprise version and it will be fixed on the next release (version 2.3.3). I will inform this forum thread as well once this is done.

 

Regards

Johnny


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 11 September 2017 - 07:16 AM

Hello guys,

 

The version 2.3.3. is now available with this issue fixed. Thanks @arve for informing us for this bug.

 

Enjoy :)

Regards

Johnny