Export button
- Single Page
Posted 09 November 2013 - 08:26 AM
I saw that there is a export button that exports the list to xls.
It opens fine in excell, but it is actualy a csv.
When I want to ceate a mailinglist in word and connect to this xls file it gives a error.
I can solve this by rename .xls to .csv.
Is there a way that when I hit the export button, that it saves the list with the extention .csv instead of .xls?
Regards
Ralph
Posted 09 November 2013 - 11:54 AM
Here's a cheesy way of doing it:
In your editor, open Grocery_CRUD.php inside the libraries folder under the applications folder.
Proceed to line# 1602.
You will find these last few characters in that line: ".xls";
Replace the xls with csv.
Save the file and you're good to go.
That's it!
Regards,
Ed
P.S. Don't forget to click the LIKE button!
Posted 09 November 2013 - 19:07 PM
Exporting to CSV instead of XLS can be accomplished several ways. The neater way of doing this is to replace the default grocerycrud action for export using the getState function. Always remember that this procedure works only if you use the datatables theme.
step 1 - Insert the code to use the datatables theme.
example:
$gcrud->set_theme('datatables');
step 2 - Insert the code to override using getState. The code is placed between the render and the view.
For example, your code might look like this:
$output = $gcrud->render();
$output = $gcrud->render();
// overriding the export action
step 3 - Add these 2 new functions to replace grocerycrud's export function. Copy exactly as is:
public function export_to_csv($state_info = null)
Then you're done!
Don't forget to click the Like button!
Ed Ramirez
Posted 10 November 2013 - 07:43 AM
Why use such a bunch of text while you can fix it with changing one line.
The thing is that you dont save a xls file, you are saving a csv file with the extention xls
Try opening a real xls file in notepad, you get rubish,
Try open this export file and you see a readable tab sepperated file.
So why is the second post neater?
Freindly regards Ralph
Posted 11 November 2013 - 02:25 AM
The second option is for others who are following this thread and want a solution that applies to one particular controller only but don't want to fiddle around with the core grocerycrud files.
Regards,
Ed Ramirez
Posted 11 November 2013 - 20:42 PM
The second option is for others who are following this thread and want a solution that applies to one particular controller only but don't want to fiddle around with the core grocerycrud files.
Regards,
Ed Ramirez
oh yes ofcourse,
that makes perfect sense so people have a choice.
thanks for the clarification!
Ralph
Posted 25 January 2018 - 05:47 AM
why its not working