Codinghtml table collapse IE vs FF

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Peter (BOUGHTONP)  
 To:  ALL
32585.1 
I have a problem with collapsable table cells in Firefox.

First, look at this page in Internet Explorer, and it should work as intended:
http://www.hybridchill.com/misc/table_collapse.html

You click show/hide and it expands/collapses to show individual records.

Now try it in Firefox - everything is all skewed, and you can't expand individual records.

I need to re-write the whole section to work completely differently (will be using nested lists and stuff), but in the mean time it would be useful for me to work with it in Firefox, so does anyone know any quick-fixes that will get it working for FF?

Doesn't really need to be cross-browser/proper or anything - just want something to let me use FF (for the subsequent pages) for the next few weeks, until I can get the non-shit version done.
0/0
 Reply   Quote More 

 From:  Dave!!  
 To:  Peter (BOUGHTONP)     
32585.2 In reply to 32585.1 
Well the W3C's validator throws 2 errors at you (linky), not sure how much fixing those will affect things mind you.
---

This signature is a stub. You can help Teh Forum by expanding it.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Dave!!     
32585.3 In reply to 32585.2 
That's just because I quickly pulled the code out of a page, and so it had no html/head/body tags.

Have put those in now and it validates fine.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Peter (BOUGHTONP)     
32585.4 In reply to 32585.1 

As far as I can tell, it's the rowspans conflicting with the fact that when hidden there are no rows to span. Also you might want to use "display: table-row" rather than block.

 

And you don't seem to have any colspans despite having a mismatch in column numbers - is this not needed anymore?

 

So at a guess, you'd have to make the javascript add in/remove the rowspans as appropriate.

 

As for the javascript not making rows show/hide in ff... what's rclass? I've never heard of it and ff isn't picking it up (it's always undefined). If you switch rclass with id it works fine.


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
32585.5 In reply to 32585.4 
Bah, rclass was a made-up attribute to make splitting easier - I moved it into class to make sure things validate, forgetting the JS used it. :S
Have just put it back again.

Afaik, you don't need colspans if you have rowspans - there's four rowspans in each gap that make up for the four 'missing' columns.

table-row doesn't work with IE. :(

Will try dynamically changing the rowspan and seeing if that works.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
32585.6 In reply to 32585.4 
Have uploaded latest code - layout skewing is fixed, but the functionality broken. :(
I think I'm doing something stupid with this JavaScript, but can't see what it is. Any ideas?

JavaScript code:
thisRow = rows[i];
if (thisRow.rclass == classId)
{
	x += '[i:'+i+']';
	if (thisRow.style.display == 'none')
	{
		thisRow.style.display = 'block';
	}
	else
	{
		thisRow.style.display = 'none';
	}
}
else
if (thisRow.id == classId)
{
	for (n in thisRow.childNodes)
	{
		if (n != 'length')
		{
			thisCol = thisRow.childNodes[n];
 
			if (thisCol.className == 'td_all')
			{
				if (thisCol.crowspan == thisCol.rowspan)
				{thisCol.rowspan = 1;}
				else
				{thisCol.rowspan = thisCol.crowspan;}	
			}
		}
	}	
}
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Peter (BOUGHTONP)     
32585.7 In reply to 32585.6 

Not sure what you're trying to do with that code - does rclass now work. If so, why check for both rclass and id? If not, crowspan won't either, will it?

 

And wouldn't it be better to work out the appropriate rowspan in js?


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
32585.8 In reply to 32585.7 
The rowspan will be inserted by the server-side code, which is faster since it's already got it.

Oh bugger - I see what you're saying now - Firefox is ignoring the rclass attribute because it's evil and shit. I'll just put it back in class, because the row_indiv bit will be constant.

And yeah, that means crowspan wont work either, so I'll have to calculate it. Bah.


.... okay, might have got it working, but my machine has started getting stupid and seems about to die, so not able to test it yet.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Peter (BOUGHTONP)     
32585.9 In reply to 32585.6 

I feel like I'm missing something so I probably am...

 

That code isn't triggering for anything because ff won't pick up 'rclass' (I assume it would if you were working in pure xml) and there are no appropriate ids set..?


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
32585.10 In reply to 32585.9 
yeah, it wouldn't pick up the rclass - was just returning undefined for it, so everything else was failing.

it appears to be almost working now - the rows show, but it is leaving behind blank rows after re-hiding.
However Windows is fucked and I've no idea how much of it not working is down to Windows being shit.
Going to go have some lunch and hopefully this bloody OS will have sorted itself out by the time I get back.
0/0
 Reply   Quote More 

 From:  Drew (X3N0PH0N)  
 To:  Peter (BOUGHTONP)     
32585.11 In reply to 32585.8 

(hug)

 

If you really want to pass the target-rowspan through a tag, maybe you could pass it through something valid where it won't do anything, like 'align' or maybe 'href' or something?

 

Either that or declare it as xml.


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  Drew (X3N0PH0N)     
32585.12 In reply to 32585.11 
I think IE tends to trip up on xml-in-html stuff - throws it into quirks mode or something.

Was thinking of passing it through as tabindex, but not sure if the problem is there now, or with the closing bit, so dunno if that would help.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ALL
32585.13 
Bah, wasn't calculating properly so I did need to use another attribute to pass it through with.
Also, firefox requires display='table-row', but IE requires display='block', so I've got to do a browser if thing. :@

Other than that, it's all working... hopefully it stays like that when I plug all these changes back into the original code.
0/0
 Reply   Quote More 

Reply to All    
 

1–13

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats