I am generating HTML tables based on SQL statements for a Datawarehouse created through meta table information.
One of the issues I have is some of returned Datatables have 100 plus columns. Is there a neat way of displaying this in an HTML table or a specific design solution. Please note I am looking at the display here. Changing the amount of columns available is not an option. All columns need to be rendered.
Many thanks in advance for input.
I can think of 2 good solutions:
Wrap the whole table with a fixed-width container, and set overflow-x: auto on it. That will cause the table to scroll.
Allow the user to filter out whichever columns he doesn't need to see using JavaScript/jQuery.
Both are possible, the first is obviously easier to implement, but with the second you have more control. Choose your path and if you're stuck, you can ask here on StackOverflow for help.
What you are describing is called datagrid. You definitely should not generate the HTML yourself(as you sad) and instead just bind the result set to any kind of server-side data-grid or use some kind of client-side jQuery datagrid implementation.
https://stackoverflow.com/questions/159025/jquery-grid-recommendations
Related
For a small in-house project I need to display tabular data grouped by a certain column. It would be nice to be able to expand/collapse the groups. The Group title is a simple text string.
Is there an easy way to accomplish this with standard controls, preferably using data-binding instead of manually populating for example a ListView control?
You may be able to achieve what you need using SubDatasheets in Access.
Another way to display information, if you don't have too many columns, is to use a tree view.
There is even a 100% VBA one!
Lets say I want to make a website in which only one HTML template is used. For example, if one wants to create a new object, he clicks a button, and form shows up, leaving the remaining web page intact. My question is simples: should I use only 1 view to handle all the possible inputs/outcomes or should I have multiple views that handle the same template?
Thanks in advance
You can do one view, but if it starts to get complex, accounting for each possible input and output can become a headache. I suggest you use as many views as you need and then later implement AJAX to present everything as if it's only one-page
Seems like if that is the only thing that you want to do, having one FormView and handling the cases accordingly should suffice. For a given form, if it's not necessary, keeping it to one view is generally a good choice.
I'm extremely new to Grails and Groovy and even web development in general, so if this question seems too asinine, please bear with me, I've always been focused up-to-now on desktop development.
I'm attempting to create a web application that allows users to move objects around (drag-and-drop) on their screen from one column to another. Imagine something that allows users to organize things into various groups and each group has it's own column. Also, the users should be able to create or delete any groups they'd like. (The creating/deleting groups part I've gotten taken care of in the Groovy code).
My question is, how, in the view/HTML code, do I get the site to be dynamic in terms of creating the grid? I need one column for each group, but the dataset of groups that exist will not be static, so in theory I will never know how many columns I actually need. I'll also need to do the same thing for the rows, but I expect that doing it for the rows would be more or less the same as doing it for the column.
Thanks for any help you can provide. Cheers!
UPDATE:
I'm seeing Groovy used in the view to iterate over a list of items and create a dynamic bulleted list like this
<g:each in="${ group }" var = "group">
<li> ${ group.name } </li>
Should I just try something like that to dynamically create a <table> object? That seems like it'd work, but might not be the best way to go about it.
Take a look at JavaScript, jQuery and more specifically, jQuery UI Draggable and Droppable.
I have to create a basket/checkout page for an E-commerce site. With all these debates regarding <table>, I'm confused.
Seeing that in a basket/checkout page, products are aligned in rows with their details and with some options like remove/edit, I'm inclined to use <table> but I was told to stay away from it and use <div>/css. I mean, basket/checkout pages are data about products so I don't see any problem.
So I'm asking, am I right to use <table> or should I use <div>/css for alignment of products? Again, I'm talking about basket/checkout page.
Tables can be used for tabular data. But it's really up to you in the long run. Using semantics isn't a law, or rule. It's just best practice. I would suggest, if you're showing a "list" of products with prices you could probably mark it up as a list. If you're showing a more "data-driven" page with numbers and information then you should probably use a table.
It's up to you in the long run :-)
You're right to use tables in this instance. If you have row upon row of information (or even just one) it makes perfect sense semantically, and more importantly, from a layout point of view to do this.
The alternative with would involve far too much CSS cludge to look the same, and would render your markup into a pile of classes and divs.
The general rule i stick to is:
Div's for layout
Table's for tabular data
You won't go far wrong with this rule :)
I know this is a really old question, but the truth of the matter is that none of these answers suffice. They haven't even gone into what their tabular data really is and all anyone can offer is a general rule of thumb unless you provide more details about your specific situation. (I know you won't because you're long over this case for your particular needs, but for anyone else coming here they will know to provide more detail.)
So what is tabular data? Well I think we can all agree tabular data is data, not design elements. Data is something you would find in an excel sheet or in your database. So when deciding if your page contains tabular data, you decide if you have data or design elements. For example, does you checkout table have a remove button? Would you data about your remove button in an excel spreadsheet? Probably not.
The way I look at it, is if all the "data" you're presenting is considered tabular data, then why not make your product pages on your site a big table? People would frown. So consider this when you look at your "tabular data." Just because it looks like a table, is formatted similar to a way a table would look, doesn't necessarily mean you have tabular data. Options for shipping, subscriptions, etc, might go in a table for user accounts. So you may be fine.
For full control of your application, do you prefer a GridView or a HTML table?
And why?
For instance, I need to create on-the-fly hyperlinks-per-row in a GridView/HTML table. What object would be more easy to add that feature (or others like this one)?
Note: I'm creating programmatically my datasets
If you don't need the built in support for sorting or paging, and want more control over the rendered output then I would consider using a Repeater control to output a table. If you need the built in sorting/paging then the GridView can be very helpful.
If you want the best of both worlds, upgrade to ASP.net 3.5 and use the ListView.
EDIT: Can you clarify what you mean by 'on-the-fly hyperlinks-per-row'?
Stay away from the Gridview. It has to pull down the entire dataset to render the paging. It's much faster to render only the rows you need (e.g. rows 30 - 40 of 6,0000) and use a seperate pager control.
Also when it comes to HTML/CSS, using a repeater or listview will be much easier to debug, since you'll have total control over the code.
A plain HTML <table> generated by Response.Write is straightforward and has the added benefit that if you ever work on a non-Microsoft system, you won't feel naked without their redundant ASP.NET web controls that mostly just make it more difficult to generate the HTML everyone already knows.
I think the Repeater or the newer ListView is the way to go if you don't need sorting and/or paging. The Repeater and ListView allow you to control the HTML (the GridView is a total black box in this regard and generates atrocious HTML) while avoiding the tedious server-side code that comes with the <asp:Table> control: "OK, new row. New cell. Do something with cell. Add cell to row. Add row to table. Repeat".
On the other hand, if you need paging and sorting, the GridView is probably the better solution.
You can use GridView or more simple Repeater-like controls to build your own html, even if you have to sort/page you data.
With a Repeater for example you can build a custom system of pagination using a PagedDataSource data source with the property AllowPaging sets to true.
The only problem is clearly that with a simple Repeater you must write more code to do the work that GridView does natively.
But the result is faster.