I want to use the same method as the default export button, however I want to change the icon and caption of the button.
I know the syntax for adding a custom toolbar button but what should I put in the function field?
On a side note is there a way to see all available icons?
jQuery(document).ready(function(){
jQuery(‘#list1’).jqGrid(‘navButtonAdd’, ‘#list1_pager’,
{
‘caption’ : ”,
‘buttonicon’ : ‘ui-icon-print’,
‘onClickButton’: function()
{
// what should i put here
},
‘position’: ‘last’
});
});
You can call this function inside onClickButton callback and can replace pdf with csv,xls,html.
jqgrid_process_export(‘pdf’);
This solution doesn’t seem to work, after I press button nothing happens.
jQuery(document).ready(function(){
jQuery(‘#list1’).jqGrid(‘navButtonAdd’, ‘#list1_pager’,
{
‘caption’ : ”,
‘buttonicon’ : ‘ui-icon-print’,
‘onClickButton’: function()
{
jqgrid_process_export(‘pdf’);
},
‘position’: ‘last’
});
});
Please check browser debug console for JS error and paste it here.
Are you using free version or full version?
You can also use:
window.open(“?grid_id=list1&export=1&jqgrid_page=1&export_type=html”);
where list1 is grid id and “html” is format to export, which could be pdf,csv,xls.
Users.php:355 Uncaught ReferenceError: jqgrid_process_export is not defined
at HTMLTableElement.onClickButton (Users.php:355)
at HTMLTableCellElement.<anonymous> (jquery.jqGrid.min.js:9)
at HTMLTableCellElement.dispatch (jquery.min.js:3)
at HTMLTableCellElement.r.handle (jquery.min.js:3)
This was the error while using jqgrid_process_export(‘pdf’) and I am using the premium version, however with window.open(“?grid_id=list1&export=1&jqgrid_page=1&export_type=html”), everything seems to work just fine so thanks.