简体   繁体   English

如何用HTML显示100,000行或更多行的数据库查询结果?

[英]How to display database query results of 100,000 rows or more with HTML?

We're rewriting a website used by one of our clients.我们正在重写我们的一位客户使用的网站。 The user traffic on it is very low, less than 100 unique visitors a week.它的用户流量非常低,每周不到 100 个独立访问者。 It's basically just a nice interface to their data in our databases.它基本上只是我们数据库中数据的一个很好的接口。 It allows them to query and filter on different sets of data of theirs.它允许他们查询和过滤他们不同的数据集。

We're rewriting the site in Python, re-using the same Oracle database that the data is currently on.我们正在用 Python 重写站点,重新使用数据当前所在的同一 Oracle 数据库。 The current version is written in an old, old version of Coldfusion.当前版本是用旧版 Coldfusion 编写的。 One of the things that Coldfusion does well though is displays tons of database records on a single page. Coldfusion 做得好的一件事是在单个页面上显示大量的数据库记录。 It's capable of displaying hundreds of thousands of rows at once without crashing the browser.它能够一次显示数十万行而不会导致浏览器崩溃。 It uses a Java applet, and it looks like the contents of the rows are perhaps compressed and passed in through the HTML or something.它使用 Java 小程序,看起来行的内容可能被压缩并通过 HTML 或其他东西传递。 There is a large block of data in the HTML but it's not displayed - it's just rendered by the Java applet. HTML 中有一大块数据,但没有显示——它只是由 Java 小程序呈现。

I've tried several JavaScript solutions but they all hinge on the fact that the data will be present in an HTML table or something along those lines.我已经尝试了几种 JavaScript 解决方案,但它们都取决于这样一个事实,即数据将出现在 HTML 表格或类似的东西中。 This causes browsers to freeze and run out of memory.这会导致浏览器冻结并耗尽内存。

Does anyone know of any solutions to this situation?有谁知道这种情况的任何解决方案? Our client loves the ability to scroll through all of this data without clicking a "next page" link.我们的客户喜欢无需单击“下一页”链接即可滚动浏览所有这些数据的功能。

I have done just what you are describing using the following (which works very well):我已经使用以下方法完成了您所描述的操作(效果很好):

jQuery Datatables jQuery 数据表

It enables you to do 'fetch as you scroll' pagination, so you can disable the pagination arrows in favor of a 'forever' scroll.它使您能够进行“滚动时获取”分页,因此您可以禁用分页箭头以支持“永远”滚动。

Give a try with Jquery scroll.尝试使用 Jquery 滚动。

Instead of image scroll , you need to have data scroll.您需要滚动数据而不是图像滚动。

You should poulate data in the divs , instead of images.您应该在 divs 中填充数据,而不是图像。

http://www.smoothdivscroll.com/#quickdemo http://www.smoothdivscroll.com/#quickdemo

It should work.它应该工作。 I wish.我希望。

You gotta great client anyway :-)无论如何,您必须是很棒的客户:-)

Something related to your Q与你的 Q 相关的东西

http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html

http://api.jquery.com/scroll/ http://api.jquery.com/scroll/

I'm using Open Rico 's LiveGrid in a project to display a table with thousands of rows in a page as an endless scrolling table.我在一个项目中使用Open Rico的 LiveGrid 将一个页面中包含数千行的表格显示为一个无限滚动的表格。 It has been working really fine so far.到目前为止,它一直工作得很好。 The table requests data on demand when you scroll through the rows.当您滚动浏览行时,表格会按需请求数据。 The parameters are send as simple GET parameters and the response you have to create on the serverside is simple XML.参数作为简单的 GET 参数发送,您必须在服务器端创建的响应是简单的 XML。 It should be possible to implement a data backend for a Rico LiveGrid in Python.应该可以在 Python 中为 Rico LiveGrid 实现数据后端。

Most people, in this case, would use a framework.在这种情况下,大多数人会使用框架。 The best documented and most popular framework in Python is Django. Python 中记录最好且最受欢迎的框架是 Django。 It has good database support (including Oracle), and you'll have the easiest time getting help using it since there's such an active Django community.它具有良好的数据库支持(包括 Oracle),并且您将最容易获得使用它的帮助,因为有如此活跃的 Django 社区。

You can try some other frameworks, but if you're tied to Python I'd recommend Django.您可以尝试其他一些框架,但如果您使用 Python,我会推荐 Django。

Of course, Jython (if it's an option), would make your job very easy.当然,Jython(如果它是一个选项)会让您的工作变得非常轻松。 You could take the existing Java framework you have and just use Jython to build a frontend (and continue to use your Java applet and Java classes and Java server).您可以使用现有的 Java 框架,并仅使用 Jython 来构建前端(并继续使用您的 Java 小程序、Java 类和 Java 服务器)。

The memory problem is an interesting one;记忆问题是一个有趣的问题; I'd be curious to see what you come up with.我很想知道你想出了什么。

Have you tried jqGrid ?你试过jqGrid吗? It can be buggy at times, but overall it's one of the better JavaScript grids.它有时可能有问题,但总的来说它是更好的 JavaScript 网格之一。 It's fairly efficient in dealing with large datasets.它在处理大型数据集时相当有效。 It also has a feature whereby the grid retrieves data asynchronously in chunks, but still allows continuous scrolling.它还具有网格以块为单位异步检索数据的功能,但仍允许连续滚动。 It just asks for more data as the user scrolls down to it.当用户向下滚动到它时,它只是要求提供更多数据。

I did something like this a while ago and successfully implemented YUI's data table combined with Django前阵子做过这样的事情,成功实现了YUI的数据表结合Django

http://developer.yahoo.com/yui/datatable/ http://developer.yahoo.com/yui/datatable/

This gives you column sorting, pagination, scrolling and so on.这为您提供了列排序、分页、滚动等。 It also allows you to use a variety of data sources such as JSON or XML.它还允许您使用各种数据源,例如 JSON 或 XML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM