开发者

Rendering loads of data in table format

开发者 https://www.devze.com 2023-01-11 18:21 出处:网络
I have a webpage which displays loads of data (say around 1,000) retrieved from the back end and is displayed in a proper HTML table format with proper styling and stuff.

I have a webpage which displays loads of data (say around 1,000) retrieved from the back end and is displayed in a proper HTML table format with proper styling and stuff.

Now my question is, I am working on Java-based web environment, so in order to display this loads of data I use JSP and the compiled JSP file when returned from the tomcat server comes to size in MB's.

I believe this might be the case for any server-side-language (correct me if I am wrong)

What I want to know is, if instead of making the whole table in JSP and increasing my page size when returned from tomcat, I use JavaScript to render the tabular format i开发者_开发问答n a blank HTML page, would this be a recommended flow?

What is the impact on the browser when I use JavaScript and is the flow logical and recommend one?


If you want to display all the rows at once, there wouldn't be any big advantages to using Ajax to retrieve the data after the page loaded.

A small advantage would be that your server could quickly return a small page that says "Loading" and then use Ajax to do the load. At the end of the load, the Javascript (JS) would remove the Loading feedback.

If you want to page your data on the browser, enable the user to re-arrange the columns, sort the data locally and other fun stuff, you could use a JS datatable widget. There are many to choose from, I recommend the YUI Datatable widget. A community too.

In fact, I'm busy adding one to my site as I write this...

Added:

What is the impact on the browser when I use javascript and is the flow logical and recommended one?

Browser impact is usually non-material. However, browser quirks tend to occur more often when using JS and fancy widgets. If you're ok with the Yahoo "Grade A" browser list then you'll be fine. But if you want to support any random browser, then you should stick with plain html.

Browser speed becomes more important with JS widgets. I actively put up a warning to my IE users telling them that they'd be "much more productive" if they switched to an IE alternative. (Rather than talking about the speed of the browser, I give the advantage to the user: greater productivity.)

Re: Is an Ajax page a recommended flow? Yes, it's "Web 2.0." Nothing wrong with plain HTML, but using Ajax and a data table widget can bring your users many advantages.

But you'll need to see if the costs/benefits of switching are appropriate for you and your situation.

0

精彩评论

暂无评论...
验证码 换一张
取 消