Two Tables

JavaScript and client side scripting.

Moderator: General Moderators

matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

It seems you are making it very very difficult for yourself. Splitting data in 2 tables which in fact should be in one, not using a fixed width (px or %) for the table cel widths, mixing php, html, javascript/dom. I'm curious:
- why is it needed to use 2 tables? Why not start with one? Let the backend code spit out the minimal amount of html needed, so you have a nice seperation
- why no fixed width (px or %). Why not let the text flow down the cells. My example works perfectly.
- then if everything works nicely see if there's some possibility of using an unobtrusive js which can make the table th a fixed one. That way you start with clean code, clean seperation of php, html, css and js, and a semantic and accessible table
(not trying to be harsh here, only curious)
User avatar
phppage
Forum Contributor
Posts: 126
Joined: Mon Apr 24, 2006 1:47 pm
Location: West Yorkshire, UK

Post by phppage »

If you check the example on http://www.quirksmode.org/js/fixedhead.html you can see what I am trying to achieve. I did say this was plan z so it is a bit messy. The problem is that the Fullname and Action columns could be any given widths so don’t really want it to look disproportioned. I may have to settle for fixed width but thought dynamic would be better and the way forward. The reason why I want two tables is so one can stay at the top fixed and the other in another div to scroll.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

Yes, having to go for plan z is never nice :(
But maybe a plan b or c would be possible. I can imagine that with some clever DOM scripting using one table should be possible. I'll see if I can find some script in one of my bookmarked sites. you never know.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What about creating your table, then creating one of those javascript based floating elements that stays in a fixed position on the screen? So when the user scrolls, the table header always appears to be floating at the top most part of the table. I'm just throwing out ideas to help you out, so if anything I say from this post on is crap, feel free to disregard it without hurting my feelings.

Just be gentle... I am a fragile man...
User avatar
phppage
Forum Contributor
Posts: 126
Joined: Mon Apr 24, 2006 1:47 pm
Location: West Yorkshire, UK

Post by phppage »

Everah wrote: I'm just throwing out ideas to help you out, so if anything I say from this post on is crap, feel free to disregard it without hurting my feelings.

Just be gentle... I am a fragile man...
All input is welcome with open arms :D . That would be one way round it. The kind of look I'm going for is Lotus Notes table with headers above with "header^". With the carrot point which way you want the data sorted for that paticular column. If your not too familiar with Lotus Notes check out the details view in Windows Explorer. Saying all this I may well have to make a compromise at some point. Bad news, my main machine has gone down and will have to be rebuilt so may be some delay in trying any suggestions. :cry: It has been very much one of those days :x.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I'm a Lotus Notes user at work (unfortunately - that is for a different discussion) so I am familiar with it, and your situation (I have gone through a few system disintegrations).

I am of the mind set that tabular data should be in tabular format, even with scrolling headers. So I would create my tabular display within a single table, and, if the data got too long, I would page it. That's just me, though. I'm a geek that way.
User avatar
phppage
Forum Contributor
Posts: 126
Joined: Mon Apr 24, 2006 1:47 pm
Location: West Yorkshire, UK

Post by phppage »

Had to admit defeat in the end an use fixed column widths. Still looks great though. Thanks for eveyones time who looked in to this for me. :D
Post Reply