Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csv download plugin #480

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

csv download plugin #480

wants to merge 7 commits into from

Conversation

veto64
Copy link

@veto64 veto64 commented Jul 24, 2019

hi,
i would like to start contribute to this great project and i added a small plugin to download the grid as a CSV file.
please guide me about any code style standards and your requirements

thanks,
veto

@veto64
Copy link
Author

veto64 commented Aug 9, 2019

example usage :
.jqGrid("navButtonAdd", "#grid_toppager", {
caption: "Download CSV",
id:"download",
buttonicon: "fa-file-excel-o",
onClickButton: function(err,res){
jQuery(this).jqGrid("jqgrid_download",'csv');
}
});

@Nimesin-Boxmark
Copy link

Can you change code so it will have few new parameters, with default values:

Line 50:
jqgrid_download: function (format , separator = ',', endline = '\n' )

Line 76:
let csv = "data:text/csv;charset=utf-8," + rows.map(e => e.join(separator)).join(endline);

So there can be different separators and line ends used
(we use here ';' as separator, and windows line end is '\r\n')

And, can you organize line 52 as switch/case, so it can be easily extended for more formats?

@veto64
Copy link
Author

veto64 commented Sep 13, 2019

apologize for late reply,

i just changed it:
https://github.com/veto64/jqGrid/blob/master/plugins/jqgrid_download.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants