来自 Asp.net mvc 的大型 html 页面
我有一个视图,它基本上显示网格中的一堆行和列(直接来自表格)。
到目前为止,这工作正常,但是,当我的表中有 600 行和大约 30 列时,在 Chrome 中看不到页面,同时 CPU 保持在大约 50%。
显然我需要进行某种分页,但我想知道这是否符合预期(即无法在浏览器中查看大型 html 文档),并且还有一种方法可以将视图保存为文本文件而不是尝试在浏览器中查看?换句话说,在浏览器尝试渲染页面之前查看页面的内容(例如页面视图源)。
** 进一步调查 **
我当前正在使用 JQueryMobile,我删除了页面引用的脚本,并且表格未加载。知道为什么脚本会导致如此多的加载问题吗?
TIA
JD
I have a view which basically shows a bunch of rows and columns in a grid (which come directly from a table).
So far this is working fine, however, when I have 600 rows in the table and about 30 columns the page is not viewed in Chrome whilst the CPU stays at about 50%.
Clearly I need to put in some sort of paging but I was wondering whether this is as expected (i.e. large html documents cannot be viewed in a browser) and also is there a way I can save the view as a text file rather than trying to view it in the browser? In other words, to see the content of the page (like page view source) before the browser tries to render it.
** Further Investigation **
I am currently using JQueryMobile and I removed the scripts the page references and the table is no loading. Any ideas why the scripts are causing so much problems with loading?
TIA
JD
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这取决于很多因素,例如您的硬件、返回的数据量以及返回数据后您对数据的处理方式以及浏览器本身。您可以尝试使用不同的浏览器,看看是否有任何差异。您对分页的看法是正确的,您将需要它才能使其以可接受的方式工作。
浏览器需要下载页面才能看到源代码,在页面完全下载之前这是无法完成的。如果您只想查看页面的内容,可以使用 curl 将文件下拉到本地文件系统。
It would depend on quite a few things like your hardware, how much data is returned and what your are doing with the data once it is returned and the browser itself. You could try a different browser and see if there is any difference. You are right about paging, you will need it to make it work in acceptable manner.
The browser needs to download the page before you can see the source, this can't be done before the page is completely downloaded. If you just want to see the contents of the page you can use curl to pull down the file to the local filesystem.
我想说这种行为是预期的;正如你所说,分页是一个可能的解决方案。
您可以选择渲染为 Excel 或 CSV。 SO 上还有其他问答提供了相关基础知识,例如
CSV
< a href="https://stackoverflow.com/questions/362222/render-excel-file">Excel
I would say that behaviour is expected; as you say, paging is a possible solution.
You could choose to render to Excel or CSV. There are other Q&As on SO that give the basics for this, e.g.
CSV
Excel
在浏览器完全接收表格之前,无法呈现表格。因为最后一个单元格的微小变化可能会导致总表的布局发生变化。
600x30 的单元不算大,但也不算小。所以我可以想象 Chrome 的人不会针对这种表格进行优化。
如果您指定每列的宽度,也许性能会更好。
A table cannot be rendered before it is completly received by the browser. Because a small change in the last cell can cause layout changes in the total table.
600x30 cells is not that big, but it is not small either. So I can imagine the guys from Chrome not optimizing for this kind of tables.
Maybe performance will be better if you specify the width of each column.
不好的是,我只是想获取表中的数据,并且因为我在另一个项目中使用 JQueryMobile,所以我使用了 JQM 中的复选框,这些复选框并不是为处理大量数据而设计的。
我目前正在分页,数据按预期显示。
感谢所有提供帮助的人。
My bad, I just wanted to get data in a table and as I was working with JQueryMobile in another project so I used the checkboxes from JQM which are not designed to handle large amounts of data.
I am currently paging and the data is shown as expected.
Thanks to all those that helped.