Upload a csv
Upload a csv
I found your plugin, it looks extreemely cool, and I think will do exactly what I need.
Unfortunately, I have not been able to figure out the first step in what I need to do, which is load a CSV file.
I found the sAjaxSource function, but it appears to use a json file. The data that I have is in a csv format, and I don't want to use a server side script to convert it to json, and I've read it's not a good idea to convert csv to json for large files in jquery.
Does your DataTables plugin allow loading of csv files into tables? or what other formats besides json?
Thanks
Jim
Unfortunately, I have not been able to figure out the first step in what I need to do, which is load a CSV file.
I found the sAjaxSource function, but it appears to use a json file. The data that I have is in a csv format, and I don't want to use a server side script to convert it to json, and I've read it's not a good idea to convert csv to json for large files in jquery.
Does your DataTables plugin allow loading of csv files into tables? or what other formats besides json?
Thanks
Jim
This discussion has been closed.
Replies
I'm sorry to say that you'll need to convert your data format to JSON if you want to have it loaded Ajax style from the server since DataTables doesn't support any other data formats. The other methods for getting data is directly from the DOM or server-side processing (typically from a SQL database). It shouldn't be too hard to have a little script which converts your CSV into JSON, is there a reason you don't want to do this?
Regards,
Allan
Thanks for the reply.
I wanted to avoid any server side processing, and had read that using Javascript for parsing to JSON could be very slow.
As it turns out, I have too much data (7500 rows x 8 colums) for file based DataTables. At least, it ran very very slowly, the page took over 2 minutes to load.
So I imported the data into a MySQL DB, and used server side scipting to load it into DataTables. I mostly have it all working now, except to tweak the server side query script for multi-column formatting. Speed is amazing, everyone's been very impressed with the real time filtering.
The server side processing will be a challenge in the long run, as we are moving away from PHP/MySQL to Java/Oracle, and the html web pages will be on one server, and the java on a different one. My guess is I'm going to run into cross domain issues, but will cross that bridge when I come to it.
Once I got DataTables figured out, I was impressed with how easy it is to create a great looking/great featured table! :-) Lots of well document features for customizing, very impessive!
Cheers,
Jim
Good to hear you got it sorted and that it was well received. I think you are right, with that many records, server-side processing is the way to go (there are tricks such as bSortClasses to speed up client-side handling, but it probably still wouldn't be as fast as server-side).
Thanks for the kind words!
Allan