jQuery jqGrid 和 dataTable,哪个更好?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3091227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jqGrid or dataTable, which better?
提问by klox
i'm interest to use jQuery dataTable... could you tell me and give me an example how to use that..and i've been heard about jqGrid too..which better from both of them?
我对使用 jQuery dataTable 很感兴趣......你能告诉我并给我一个如何使用它的例子......我也听说过 jqGrid ......从他们两个中哪个更好?
i've been try to download dataTable..
我一直在尝试下载数据表..
<script type="text/javascript" src="jquery.dataTables.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#showdata').dataTable( {
//what must i fill in this area?
});
});
</script>
采纳答案by dzida
I've tried both and decided to use datatables. I found it has better documentation, better community support and it was more straightforward to start and use this plugin.
我已经尝试了两者并决定使用datatables。我发现它有更好的文档、更好的社区支持,而且启动和使用这个插件也更简单。
Basically if you have html code like this:
基本上,如果你有这样的 html 代码:
<table>
<thead>
<tr>...</tr>
</thead>
<tbody>
<tr>...
</tbody>
</table>
(mind theadand tbody)
(记THEAD和TBODY)
Then yours example should generate nice datatable. There are numbers of parameters to customize it but it is optional to use them.
那么你的例子应该会生成很好的数据表。有许多参数可以自定义,但使用它们是可选的。
You should also consider if you want to generate your datatable based on:
您还应该考虑是否要基于以下内容生成数据表:
- static html content (load once)
- content received from your server
- 静态 html 内容(加载一次)
- 从您的服务器收到的内容
Both options are possible with datatables and both have many examples on datatables.net.
这两个选项都可以用于数据表,并且在datatables.net上都有许多示例。
In case of any problem drop an info with the details.
如果有任何问题,请提供包含详细信息的信息。
回答by Louis
jqgrid seems to be more powerful and flexible, however, terrible documentation. If you don't have someone around to help with jqGrid, you are better off with datatable.
jqgrid 似乎更强大和灵活,但是,糟糕的文档。如果您身边没有人帮助您使用 jqGrid,那么您最好使用 datatable。
回答by Typo Johnson
I'm using DataTables too. I was attracted by the docs, the api and the flexibility. In my project I have an ajax front end where the table contains editable controls and column sorting/filtering. Some grids have all the data on the client, some pull their data from paged server calls, depending on the volume of data.
我也在使用数据表。我被文档、API 和灵活性所吸引。在我的项目中,我有一个 ajax 前端,其中表格包含可编辑控件和列排序/过滤。一些网格在客户端拥有所有数据,一些网格从分页服务器调用中提取它们的数据,这取决于数据量。
The developer has total control over the column rendering. I recommend it if you want flexibility. It's worth it. The author, Allan Jardine, is clearly very talented
开发人员可以完全控制列渲染。如果你想要灵活性,我推荐它。这很值得。作者 Allan Jardine 显然非常有才华
回答by Luis Filipe Nassif
I began to use datatables, but it became very slow to load and sort a few hundreds of local items. So i tried jqgrid and it runs fine with thousands of local loaded items. So jqgrid has better performance. But sometimes i need to work with dozens of thousands of local items, and jqgrid becomes slow too. I know these plugins are designed to work with client/server architeture, so i am evaluating to change the design of my application.
我开始使用数据表,但加载和排序数百个本地项目变得非常缓慢。所以我尝试了 jqgrid 并且它在数千个本地加载的项目上运行良好。所以jqgrid有更好的性能。但有时我需要处理成千上万个本地项目,而 jqgrid 也变得很慢。我知道这些插件旨在与客户端/服务器架构一起使用,因此我正在评估更改我的应用程序的设计。
回答by MvcCmsJon
My company just made the decision to go with DataTables also for all the reasons mentioned above. We had evaluated it a few years ago and it seems like many of it's shortcomings we found then have been identified by the team. It's not perfect but I think once we have committed to learning it inside and out it will do just fine.
由于上述所有原因,我的公司刚刚决定使用 DataTables。几年前我们对它进行了评估,似乎我们当时发现的许多缺点已经被团队发现了。它并不完美,但我认为一旦我们致力于从内到外学习它,它就会做得很好。