⚠ 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

add_action - generate files



guillom
  • profile picture
  • Member

Posted 27 September 2013 - 09:42 AM

hello there!

First : thanks for grocerycrud! realy fine.

 

Second : here is my question : 

I want to build excel files with the records i show with grocerycrud. So I decided to use the add_action to do this : here is my code:

	 public function intervention()
    {
	/*
        $this->grocery_crud->set_table('intervention');
        $output = $this->grocery_crud->render();
 
        $this->intervention_output($output);         */
     
	$crud = new grocery_CRUD();
	 
		$crud->set_theme('datatables');
		$crud->set_table('intervention');
		$crud->add_action('navette', '', '','ui-icon-image',array($this,'fichenavette'));

		$output = $crud->render();
	 
		$this->intervention_output($output);
	}	
	function intervention_output($output = null)
    {
        $this->load->view('intervention.php',$output);    
    }

	function fichenavette($primary_key , $row)
	{	
		return site_url('fichenav.php').'?id='.$row->idintervention;
	}

fichenav.php is a file that calls the PHPExcel libraries and then build my excel file. It is located in the controllers folders.

And finally the result is a 404 page not found when i click "fichenavette".

 

I'd also like to know if grocery can send multiselected rows ids to build for each one a excel file.

 

Thanks

 


davidoster
  • profile picture
  • Member

Posted 27 September 2013 - 10:08 AM

Hello and welcome to the forums [member=guillom].

For the 404 part maybe you need to check that site_url('fichenav.php') is pointing at the right path.

 

As a general comment and as an answer about the multiselected rows, why don't you inspect the actual code that exports an Excel file at the top right button 'Export' and replicate it as per your requirements?


guillom
  • profile picture
  • Member

Posted 27 September 2013 - 12:56 PM

Thanks Ninja  :ph34r: !

I don't use the export btn because I have a lot of transformations to do before generate the file ; exemple : I put an 'X' if I find a 'true' in the cell(B29) and nothing if I find 'false'.

So I need a specific algorithm to proceed tens transformations, and more : I have to include images in my excel output. (strange but true!)

 

Well, You were right about the path : I redisigned my website and have separated completly the PHPxcel libraries and codeigniter. Works fine now.

 

thanks


davidoster
  • profile picture
  • Member

Posted 28 September 2013 - 05:29 AM

Allright!

When I said about the export button I meant to see the actual code that generates the output file and get some ideas how you could proceed with this.


edramirez
  • profile picture
  • Member

Posted 11 November 2013 - 03:22 AM

Hi guillom -

 

It would be great if you could post your code here so that we could appreciate and learn another way of exporting to excel. The grocerycrud export method is a general purpose solution which might be insufficient for the needs of certain kind of applications. So, having an alternate way is also great!

 

Ed Ramirez