将.CSV转换为HTML表格 [英] Convert .CSV to HTML Table
问题描述
我想将 .csv文件转换为jQuery中的HTML表格。为了做到这一点,我使用了一个名为 CSVToTable 的jQuery插件。
我在代码中使用它的方式如下所示:
我调用了 .CSVToTable('path /to/file.csv')
在我的< div id =ItemTable>< / div>
:
$(#ItemTable)。CSVToTable('ItemDatabase.csv',{
loadingImage:'img / loading.gif' ,
startLine:0
});
似乎所有东西都可以正常工作,并且loading.gif(包含在下载中)。
我第一次尝试在ItemDatabase.csv上运行它,它是一个.csv,其中包含约。 350线。 不断加载和加载,15分钟后,我用一个包含5行的较小文件进行了尝试。它没有区别。
我看了 他们的网站有一个演示版 ,它工作正常,取代了代码,但没有什么区别。 如果有人可以告诉我做错了什么,这将是非常有用的。
注意:我检查了文件路径,并且所有内容都已正确初始化。
编辑:对于@sakir,我的.csv文件的前4行:
名称,层,Kind,Lvl,mDam,xDam,HR,MR,SD,LS,MS,XB,LB
压低弓,压低,弓,1,0,0,无,无,无,无,无,无
橡树木弓,基础,弓,1,4,6,无,无,无,无,无,无
桦木弓,基本,弓,6,6,10 ,无,无,无,无,无,无
不能使用本地文件系统中的文件。请将您的文件复制到Web服务器上,并将URL提供给.CSVToTable(url_file)中的该文件。
I want to convert a .csv file to a HTML Table in jQuery. To accomplish that, I'm using a jQuery Plugin called CSVToTable.
The way I used it in my code is as follow:
I called the .CSVToTable('path/to/file.csv')
on my <div id="ItemTable"></div>
:
$("#ItemTable").CSVToTable('ItemDatabase.csv', {
loadingImage: 'img/loading.gif',
startLine: 0
});
Everything seemed to work, as well as the loading.gif (which was included in the download).
My first try was running it on the ItemDatabase.csv, which is a .csv that contains approx. 350 lines. It kept loading and loading, and after 15 minutes, I tried it with a smaller file that contains 5 lines. It made no difference.
I looked at the source of their website with a demo, which worked fine, replaced the code, but made no difference.
If somebody could tell me what I'm doing wrong, that would be very helpful.
Note: I checked the file paths, and everything is initialized correctly
EDIT: For @sakir, the first 4 lines of my .csv file:
Name,Tier,Kind,Lvl,mDam,xDam,HR,MR,SD,LS,MS,XB,LB
Depressing Bow,Depressing,Bow,1,0,0,NONE,NONE,NONE,NONE,NONE,NONE,NONE
Oak Wood Bow,Basic,Bow,1,4,6,NONE,NONE,NONE,NONE,NONE,NONE,NONE
Birch Wood Bow,Basic,Bow,6,6,10,NONE,NONE,NONE,NONE,NONE,NONE,NONE
You can not use file from the local-file system. Please copy your file on the web-server and provide the url to that file in the .CSVToTable(url_file).
这篇关于将.CSV转换为HTML表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!