473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Collapsable list where text is in columns with headers (like a forum for example)

Hi

I'm looking to create a colapsable list like what we see in a news reader or
on a forum.

- Basically, any number of levels up to 10 (i.e. more than whats likely to
be needed)

- Able to expand/collapse each branch independantly

- 3 columns, where columns 2 and 3 are fixed width and aligned at all levels
with column headers (this is where it could get ugly as there may not be
room for column 1 if the record is more than a few levels deep.

I looked at bodging a tree control (namely
http://www.dynamicdrive.com/dynamicindex1/navigate1.htm) by dropping a 3x1
table within each li tag but a) the columns don't line up and b) I'm pretty
sure that was a really stupid idea ;o)

Anyone got an example or pointer to something similar?

Thanks

Mark
Sep 25 '07 #1
12 1274
On Sep 26, 4:26 pm, David Mark <dmark.cins...@gmail.comwrote:

Oops. Left out the memory leak cleanup.

global.onunload = function() {
i = 0;
l = anchors.length;
while (i < l) { anchors[i++].onclick = null; }
};

Goes right before this line:

el.style.visibility = 'visible';
Sep 27 '07 #2
Thanks Mark

I'll take a look today. I had given up on the idea of column alignment for
columns 2 and 3 as there were issues with overflow text etc.

Thanks for the memory cleanup bit as well. I've been programming for years
but rarely for the web so I would have missed that one till it bit me on the
backside.

Thanks again

Mark

"David Mark" <dm***********@gmail.comwrote in message
news:11**********************@d55g2000hsg.googlegr oups.com...
On Sep 26, 4:26 pm, David Mark <dmark.cins...@gmail.comwrote:

Oops. Left out the memory leak cleanup.

global.onunload = function() {
i = 0;
l = anchors.length;
while (i < l) { anchors[i++].onclick = null; }
};

Goes right before this line:

el.style.visibility = 'visible';


Sep 27 '07 #3
pr
David Mark wrote:
[a sample application]

Good one.
Sep 27 '07 #4
pr
Mark wrote:
This works great (thanks), the only issue I got though is that in firefox
long strings don't wrap, i.e. the cell height remains constant and the table
gets wider. I even tried fixing the widths of the table and cells (in
pixels), still doesn't wrap) and then dropped the whole table inside another
fixed width table and it still gets wider rather than wrapping.
Comment out or remove 'white-space:nowrap' from the 'table.posts td' CSS.
Sep 27 '07 #5
Excellent, thanks pr

"pr" <pr@porl.globalnet.co.ukwrote in message
news:JC******************@newsfe3-win.ntli.net...
Mark wrote:
>This works great (thanks), the only issue I got though is that in firefox
long strings don't wrap, i.e. the cell height remains constant and the
table gets wider. I even tried fixing the widths of the table and cells
(in pixels), still doesn't wrap) and then dropped the whole table inside
another fixed width table and it still gets wider rather than wrapping.

Comment out or remove 'white-space:nowrap' from the 'table.posts td' CSS.

Sep 27 '07 #6
On Sep 27, 3:10 am, "Mark" <Mr...@asdfgh.comwrote:
Hello again

This works great (thanks), the only issue I got though is that in firefox
long strings don't wrap, i.e. the cell height remains constant and the table
gets wider. I even tried fixing the widths of the table and
This was by design.

cells (in
pixels), still doesn't wrap) and then dropped the whole table inside another
fixed width table and it still gets wider rather than wrapping.

Work fine in IE6 though, will keep plugging at the firefox issue.
You mean the cells did wrap in IE6? That's surprising to me. I
didn't test it in IE6, but I thought the CSS I used would work the
same in IE6 as IE7 (except for the tr:hover rule.) I did just notice
that the headers are wrapping as I left out a white-space rule for
them.

Sep 27 '07 #7
On Sep 27, 7:31 am, pr <p...@porl.globalnet.co.ukwrote:
David Mark wrote:

[a sample application]

Good one.
Thanks. It turned out better than I thought it would.

Sep 27 '07 #8
Cool... I pulled out the white-space rule and everything wraps in FF and IE
now.

IE6 was ok before, not sure why. If I get time I'll put the white-space rule
back and see what happens.

Cheers

Mark

"David Mark" <dm***********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
On Sep 27, 3:10 am, "Mark" <Mr...@asdfgh.comwrote:
>Hello again

This works great (thanks), the only issue I got though is that in firefox
long strings don't wrap, i.e. the cell height remains constant and the
table
gets wider. I even tried fixing the widths of the table and

This was by design.

cells (in
>pixels), still doesn't wrap) and then dropped the whole table inside
another
fixed width table and it still gets wider rather than wrapping.

Work fine in IE6 though, will keep plugging at the firefox issue.

You mean the cells did wrap in IE6? That's surprising to me. I
didn't test it in IE6, but I thought the CSS I used would work the
same in IE6 as IE7 (except for the tr:hover rule.) I did just notice
that the headers are wrapping as I left out a white-space rule for
them.

Sep 27 '07 #9
On Sep 27, 3:10 pm, "Mark" <Mr...@asdfgh.comwrote:
Cheers David

I wanted to allow wrapping as the string lengths can be quite long and I'm
not keen on horizontal scrollbars.
I don't care for horizontal scrollbars either. So for long-winded
table cell text, wrapping makes sense.
>
Top solution btw
Thanks.
Sep 27 '07 #10
On Sep 27, 3:10 pm, "Mark" <Mr...@asdfgh.comwrote:
Cheers David
[snip]

I went to turn this into an object, which required removing the hide-
while-loading logic and noticed a mistake. This line:

el.style.visibility = 'visible';

It's nested one level too deep. Move it out one level and change it
to:

if (el) { el.style.visibility = 'visible'; }

Also, this widget should be used with a print style sheet. Two
actually as it exposes yet another CSS bug in IE.

<style type="text/css" media="print">
tr.hidden { display:table-row }
a.open, a.closed { text-decoration:none;color:black;background-
color:inherit }
a.open:before { content: "" }
a.closed:before { content: "" }
</style>
<!--[if IE]>
<style type="text/css" media="print">
tr.hidden { display:block }
</style>
<![endif]-->

Sep 28 '07 #11
On Sep 26, 9:54 pm, David Mark <dmark.cins...@gmail.comwrote:
On Sep 26, 4:26 pm, David Mark <dmark.cins...@gmail.comwrote:

Oops. Left out the memory leak cleanup.

global.onunload = function() {
i = 0;
l = anchors.length;
while (i < l) { anchors[i++].onclick = null; }

};

Goes right before this line:

el.style.visibility = 'visible';
David, thanks to your sample code post I have now lowered my self
evaluation of my javascript skills by 2 points. ;) Could you tell me
what memory leak you're referring to? I thought garbage collection
would pick this stuff off.

Bob

Sep 28 '07 #12
On Sep 28, 10:09 am, beegee <bgul...@gmail.comwrote:
On Sep 26, 9:54 pm, David Mark <dmark.cins...@gmail.comwrote:
On Sep 26, 4:26 pm, David Mark <dmark.cins...@gmail.comwrote:
Oops. Left out the memory leak cleanup.
global.onunload = function() {
i = 0;
l = anchors.length;
while (i < l) { anchors[i++].onclick = null; }
};
Goes right before this line:
el.style.visibility = 'visible';

David, thanks to your sample code post I have now lowered my self
evaluation of my javascript skills by 2 points. ;) Could you
tell me

I've lowered my own several points based on the post from late last
night. I must have been really tired when I came up with that one.
Change the correction to:

if (el && el.style) { el.style.visibility = 'visible'; }

Moving the line out a level meant that the style property was not
assured.
what memory leak you're referring to? I thought garbage collection
would pick this stuff off.
IE has a bug where closures that create circular references involving
DOM objects are not garbage collected.

http://www.jibbering.com/faq/faq_notes/closures.html

Read this line carefully and you will see that every anchor will leak
the code in its onclick event. The solution is to break the circular
references when the page is unloaded.

elPost.onclick = anchors[i].onclick = (function(posts, el) { var b;
return function(e) { e = e || global.event; b = (el.className ==
'closed'); el.className = (b)?'open':'closed'; showPosts(posts, b); if
(e.stopPropagation) { e.stopPropagation(); } e.cancelBubble = true;
return false; }; })(posts, anchors[i]);

In short, the onclick property of anchors[i] is an anonymous function
which creates a closure referencing anchors[i] as el.

Sep 28 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: news | last post by:
Is there a way to write an XML doc so that you can still format the text, bold and whatnot, and still have it display in a collapsable tree format? Here's what I'm using as a test: <?xml...
3
by: David Lee | last post by:
I have some web pages on which I'd like to suppress certain items when printing. This is mostly working nicely: index.htm (here stripped to relevant essentials) has: <head> <link...
8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
2
by: Brian | last post by:
Hope you all had a great holiday. I have a subform with a table with a combo box based on a select query. The combo box is set to display in a form in datasheet view. When I click the down...
4
by: Dino Buljubasic | last post by:
A simple way to do this is VB.NET is like this: lvwIndex.Columns.Item(e.Column).Text = _ strColHeaderNOArrow & " " & ChrW(&H25B2) I tried to do the same in C# like: ...
7
by: Rlrcstr | last post by:
How would one implement collapsable paragraphs of text in an HTML page? I want the sections of the document to be expandable for full text or collapsed into just the section heading. Any help is...
18
by: Grant Edwards | last post by:
Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages?...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.