views:

594

answers:

4

I have 3 sets of tabular data I want to display with a JavaScript framework in ASP.NET MVC. I know I can embed a separate grid in a tab, but this seems inefficient especially when large datasets are involved since I imagine 3 separate grids would be created. I haven't found a JavaScript datagrid which emulates what a spreadsheet does with multiple tabs. This example from YUI might come close though:

http://developer.yahoo.com/yui/examples/datatable/dt_dynamicfilter_source.html

I'm a little familiar with jQuery, but would be willing to switch to any framework which makes this easy. I don't really need to edit the data. Any suggestions?

EDIT: I didn't mean this to be about jQuery. Maybe some details about my scenario would help, as suggested in one of the comments. I want to display tabular data from an ordering system containing thousands of records. I'd like 3 tabs:

  1. All orders entered in the system which haven't been paid for yet.
  2. All orders from a specific vendor.
  3. All orders which have been paid for.

Since each category has thousands of rows, I only want to load data if the user starts paging.

I thought having 3 tabs with 3 separate grids (one within each tab) wouldn't be performant. I haven't actually tried though, so I'm probably guilty of prematurely optimizing. I'm looking for a grid with tab support built-in. I don't think there's one for jQuery. Perhaps ExtJS?

+1  A: 

jQuery Grid is kinda what people use a lot. I use it and it's pretty good.

jqGrid Link

I wouldn't draw a grid with three tabs. I'd use a single grid with a tab control and then load data via jQuery as required.

Or maybe have three PartialViews that you can load dynamically when you hit a tab.

griegs
You'll then lose one big benefit of losing tabs, which is not having to reload data when you switch between them.
Slack
That's true but you could load the data when you switch to the tab and the next time you switch simply display it. That way you're only loading data the user requests. I'd actually do a jQuery postback every time you switch tabs, check for changes and load only the changes if there are. I'd still use the partial view method as it allows you to make changes to a small portion of code rather than what could be a big slab of code when doing all tabs in one grid.
griegs
+1  A: 

Since you tagged this with Ext JS, I'll mention that it's quite simple to render grids into tabs using Ext JS. It also supports deferred load/render, so that only the first tab/grid would load initially, then the others would be loaded on first access. Without knowing your specific requirements it's hard to comment further.

EDIT (based on edited question): Ext grids don't directly support tabbing, but they can be embedded within a TabPanel as I mentioned for the same effect. However, based on your description, it sounds more like a filtering scenario to me. I don't see the point in having the overhead of multiple grids when only one will ever be visible, and each one's purpose is to show a specific view (i.e. filter) of the same data. I would just have a single grid with a toolbar or some other method of providing your toggle between filters, and use Ext's built-in store filtering/querying to create your views on demand. The Ext grid supports paging out of the box (client or server, in your case it would be server for thousands of records). There is also a very popular plugin called LiveGrid that provides for virtual scroll-paging of large data sets.

I'm not necessarily advocating Ext over any other framework -- I just happen to be most familiar with it and I think it could solve your problem quite nicely. I would suggest trying it out for yourself to be sure.

bmoeskau
If you use ExtJS Grids, hope you do not have people reading your pages with a screen reader. EXTJS Grid is visually beautiful and has great features, but the HTML under the hood is frightening.
epascarello
@bmoeskau: I added details about my requirements to the original post.
Slack
Yes, Ext is the ONLY RIA framework that uses complex html to render widgets. Awesome point.
bmoeskau
+1  A: 

You could also use dhtmlx grid.

mcxiand
A: 

You could use JS tab object to create tabs.

And use javascript grid framework to create grids and populate data into grids.

unigg