Click to See Complete Forum and Search --> : Maximizing Page Real-estate: Dynamic grid columns


ZenTrickz
August 17th, 2008, 03:45 AM
I am curious as to know how someone would go about varying the number of columns of a data grid depending on the current width of the browsers window.

For my particular project, I am trying to list several products. Each product has an image and description within a gird section. Although as of now my data grid is rigid, showing only 2 columns wide. For very long lists of products, the user has to scroll pretty far down... Although I fear to increase the number of columns. Users that browse under low resolution will have to scroll horizontally. This is unacceptable for my requirements.

Example: http://www.newegg.com/DailyDeal.aspx?Name=DailyDeal

Newegg.com has this feature implemented very well. If you resize the window, the number of columns will automatically change. I see that it also has a minimum number of 3 columns. This is pretty much exactly what I want. Any ideas how they went about doing this?

Many thanks in advance.

Scott.Macmaster
August 26th, 2008, 08:50 PM
Hmm, that's actually kinda' neat. Anyway, it would be done by using javascript. You would probably start by using the event handler for the window resizes. Then, use javascript to rewrite the table.

All the code would be on neweggs.com site. Probably in one of the javascript files it includes. Good luck hunting for it.