Open tinusamuel opened 10 years ago
I have exporting to Excel working using jTable. Let me know if you still need help with this.
Hi Jeff, Yes sure friend, I really need your help in this if possible, please give me sample working code. Thank your for your nice reply jeff, once again really thank you jeff
I am facing the same problem too.
me too, I even cannot make the Export to Excel and Export to PDF tabs appear in the header of the table.
I have it exporting my grid, but I'm calling a function on the server side to do this for me. I don't think there's a built-in function to do what you require.
Yes Sure Caio, I know no built function for this to achieve this goal, I'm about server side code, I tried to export by web service, unfortunately I can't export using HttpContext.Current.ApplicationInstance.Response from web service, Can you give your service side code for this?
On Sat, Mar 15, 2014 at 11:56 AM, caio notifications@github.com wrote:
I have it exporting my grid, but I'm calling a function on the server side to do this for me. I don't think there's a built-in function to do what you require.
— Reply to this email directly or view it on GitHubhttps://github.com/hikalkan/jtable/issues/1164#issuecomment-37718667 .
Brilliant Caio, so how to do this?
Post the code, please!!
<script type="text/javascript">
$(document).ready(function () {
//Prepare jTable
$('#inviteesTableContainer').jtable({
title: 'Invite friends for your performance',
paging: true,
pageSize: 10,
sorting: true,
defaultSorting: 'invitee_number ASC',
selecting: true, //Enable selecting
// multiselect: true, //Allow multiple selecting
// selectingCheckboxes: true, //Show checkboxes on first column
selectOnRowClick: true, //Enable this to only select using checkboxes
columnResizable: true, //Actually, no need to set true since it's default
columnSelectable: true, //Actually, no need to set true since it's default
saveUserPreferences: true, //Actually, no need to set true since it's default
// editinline:{enable:true},
// toolbarsearch:true,
actions: {
listAction: 'includes/invitees_Actions.php?action=list',
createAction: 'includes/invitees_Actions.php?action=create',
updateAction: 'includes/invitees_Actions.php?action=update',
deleteAction: 'includes/invitees_Actions.php?action=delete'
},
/*
toolbar: {
items: [{
tooltip: 'Click here to export this table to excel',
icon: '/Content/images/Misc/excel.png',
text: 'Export to Excel',
click: function () {
alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.');
}
}]
},*/
/* toolbar: { hoverAnimation: true, //Enable/disable small animation on mouse hover to a toolbar item. hoverAnimationDuration: 60, //Duration of the hover animation. hoverAnimationEasing: undefined, //Easing of the hover animation. Uses jQuery's default animation ('swing') if set to undefined. items: [{ icon: '/images/excel.png', text: 'Export to Excel', click: function () { //perform your custom job... } },{ icon: '/images/pdf.png', text: 'Export to Pdf', click: function () { //perform your custom job... } }] //Array of your custom toolbar items. },
// icon, text and click are optional. But you */
toolbar: { //hoverAnimation: true, //Enable/disable small animation on mouse hover to a toolbar item. //hoverAnimationDuration: 60, //Duration of the hover animation. //hoverAnimationEasing: undefined, //Easing of the hover animation. Uses jQuery's default animation ('swing') if set to undefined. items: [{ tooltip: 'Click here to export this table to excel', text: 'ZZZ', click: function () { alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.'); }
}] },
/var lineNo=0; then an field definition like lineNumber : { title: 'Line No', list: true, create: false, edit: false, display: function () {return ++lineNo} },/
fields: {
invitee_id: {
key: true,
create: false,
edit: false,
type: 'hidden',
},
invitee_number: {
title: 'Number',
width: '10%'
},
invitee_first_name: {
title: 'First Name',
width: '20%'
},
invitee_last_name: {
title: 'Last Name',
width: '25%'
},
invitee_email: {
title: 'Email Address',
width: '40%'
}
}
});
//Load person list from server
$('#inviteesTableContainer').jtable('load');
});
</script>
LOL, we don't need that xD
Hi acdigital thank you for your valuable comments, I'm so sorry to inform you that most of all members here know what possible same as you did with your code, actually we are looking for the server side web service to export the jTable grid view rather than am alert.
On Sun, Mar 16, 2014 at 2:54 AM, acdigital notifications@github.com wrote:
— Reply to this email directly or view it on GitHubhttps://github.com/hikalkan/jtable/issues/1164#issuecomment-37738440 .
Hi Caio, as I said before I am not a programmer but I will end doing what I want to do with or without your help. I didn't understand your comments. I have been trying to copy and paste pieces of codes and test them, some of them work, some not. Thanks for your help anyways. Paulo
@acdigital that was a little harsh o.O sorry I don't have a lot of time to answer right away. I have a lot on my plate nowadays.
I have no idea what language you guys are using, but we use C# at work. I have it exporting using NPOI (https://npoi.codeplex.com/).
You simply declare a static method on the server side, say "Export", so it would be like this:
[System.Web.Services.WebMethod] public static void Export() { // NPOI implementation or the call of the implementation }
Then, on the client side, you just make an Ajax call, like you normally would.
I never really worked with PHP, so I don't know how to write an export method. Sorry.
Hello Caio, sorry for some noise. See, you are speaking Chinese with me about coding. I found some server side exporting scripts that I would like to try but I even cannot make the fucking export bar to show up at the table header, If I can do it first... the real exporting action will be another chapter. Cheers, Paulo
The hardest part is actually the server side method. You can create a button that calls a server-side method to create the excel file for you, for testing.
The calling would be just like the actions you posted.
In the meantime, I have no idea why yours isn't showing. This was pretty straightforward when I had to do it.
Do you get any messages on the console? Can you tell if there's a div with a "jtable-toolbar" class attached when the page fully loads? If so, have you tried removing some CSS that might be hiding things? Can you get your listAction and all other actions to work? On the post you have posted, your toolbar is in comments /* */. Please tell me you tested WITHOUT it commented.
If you still can't figure out a way to show the toolbar, you can e-mail me your code so I can take a look.
Hi Caio, Yes I'm using ASP.Net too, but one of the my problem I can't write usual exporting codes inside web-method, this is the problem, I'm facing, I hope you can guide me how to write exporting server side code inside a web method,
On Mon, Mar 17, 2014 at 8:42 AM, caio notifications@github.com wrote:
@acdigital https://github.com/acdigital that was a little harsh o.O sorry I don't have a lot of time to answer right away. I have a lot on my plate nowadays.
I have no idea what language you guys are using, but we use C# at work. I have it exporting using NPOI (https://npoi.codeplex.com/).
You simply declare a static method on the server side, say "Export", so it would be like this:
[System.Web.Services.WebMethod] public static void Export() { // NPOI implementation or the call of the implementation }
Then, on the client side, you just make an Ajax call, like you normally would.
I never really worked with PHP, so I don't know how to write an export method. Sorry.
— Reply to this email directly or view it on GitHubhttps://github.com/hikalkan/jtable/issues/1164#issuecomment-37782036 .
Caio, a great question is more than half of the answer, thanks. Yes, I think I place
I will check the code but one of the attempts is not /commented/ Let me see and I will get back to you really quick. BTW, what is your email, can I just reply?
Many thanks again.
Caio, with this first code the table loads normally but there is nothing in the header other than the title.
toolbar: {
items: [{
tooltip: 'Click here to export this table to excel',
icon: '/Content/images/Misc/excel.png',
text: 'Export to Excel',
click: function () {
alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.');
}
}]
},
With this second one copied from jTable demo the same happens, table loads but nothing shows in the header:
toolbar: { hoverAnimation: true, //Enable/disable small animation on mouse hover to a toolbar item. hoverAnimationDuration: 60, //Duration of the hover animation. hoverAnimationEasing: undefined, //Easing of the hover animation. Uses jQuery's default animation ('swing') if set to undefined. items: [{ icon: '/images/excel.png', text: 'Export to Excel', click: function () { //perform your custom job... } },{ icon: '/images/pdf.png', text: 'Export to Pdf', click: function () { //perform your custom job... } }] //Array of your custom toolbar items. },
With the third one, nothing happens as well. The table loads ok.
toolbar: { //hoverAnimation: true, //Enable/disable small animation on mouse hover to a toolbar item. //hoverAnimationDuration: 60, //Duration of the hover animation. //hoverAnimationEasing: undefined, //Easing of the hover animation. Uses jQuery's default animation ('swing') if set to undefined. items: [{ tooltip: 'Click here to export this table to excel', text: 'ZZZ', click: function () { alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.'); }
}] },
I sent to seba.lastram@gmail.com , right?
Caio, I looked at https://npoi.codeplex.com , super duper. I have been woking with Pydio.com associated with Zoho.com interface to create, view, edit and save MS Office docs, all of them.
Dear All, am using this code for toolbar, but i don't see any toolbar and excel icon, help me
toolbar: { items: [{ tooltip: 'Click here to export this table to excel', icon: '/Content/images/Misc/excel.png', text: 'Export to Excel', click: function () { alert('This item is just a demonstration for new toolbar feature. You can add your custom toolbar items here. Then, for example, you can download excel file from server when user clicks this item. See toolbar in API reference documentation for usage.'); } }] },
Hi Friends, I'm using jTable in my project, but I need to export grid to an excel sheet, is any way to achieve this requirement?