I want to add save as pdf button instead of print button ...how to do this
Extra button
- Single Page
Posted 06 May 2013 - 12:24 PM
Posted 07 May 2013 - 09:02 AM
Posted 10 May 2013 - 05:45 AM
sir,Thanks for ur reply. I know the code for create pdf but what I want is to know about the "print" button. How to change the label from 'print' to 'save as pdf' and where to add my code for save as pdf...please help me about this..
Thanking You..
Posted 10 May 2013 - 07:10 AM
just change the label, right ?
change :
$lang['list_print'] = "Print";
in :
htdocs\grocerycrud\assets\grocery_crud\languages\your_language.php
Posted 10 May 2013 - 09:43 AM
sir,Thanks for ur reply. I know the code for create pdf but what I want is to know about the "print" button. How to change the label from 'print' to 'save as pdf' and where to add my code for save as pdf...please help me about this..
Thanking You..
Go to assets\grocery_crud\themes\your theme\views
Under this directory you will find the file list_template.php.
There you will find the code for the Excel and Print buttons.
Posted 10 May 2013 - 09:46 AM
just change the label, right ?
change :
$lang['list_print'] = "Print";in :
htdocs\grocerycrud\assets\grocery_crud\languages\your_language.php
There is also this, http://www.grocerycrud.com/documentation/options_functions/set_lang_string
Posted 11 May 2013 - 01:45 AM
iiyap ! i think i have to re-read grocery crud documentation.
Posted 11 May 2013 - 02:20 AM
thanks both of u a lot....the code some what complicated but I tried to understand....at last my problem get solve
Posted 11 May 2013 - 09:30 AM
Posted 11 May 2013 - 09:45 AM
i think what i and davidoster posted was very clear up there.
or simply, just write it in your controller :
$crud->set_lang_string('list_print','Save as PDF');
Posted 11 May 2013 - 11:03 AM
Posted 11 May 2013 - 16:15 PM
ok. i don't know if it safe or not, but try this :
1. in application/library/grocery_crud.php, find :
protected function getExportToExcelUrl() { return $this->state_url('export'); }
and change into :
protected function getExportToExcelUrl() { if (isset($this->custom_add_url)) { return site_url($this->custom_export_url); } return $this->state_url('export'); }
2. then, in your controller, write :
$crud->custom_export_url ='your_url_to_call_export_to_pdf_function';
it works like callback for button function.