Displaying Heierarchical Data

J

Joyce

I have two fields -- group, name. Group is numerical. The number of groups
is variable. I want to indent the group based on its number... 2=1 indent, 3
=2 indentations etc. (like a nested list) AND be able to manipulate the
font size, color etc? Since it's variable, it will have to loop through
until there are no cases.... any suggestions on how to do this? (I have no
trouble getting the data from the db... mySQL, ASP) Thanks in advance.

1 Mary
2 John
2 Joan
3 Kim
1 Pam
2 Carmine
1 Sam
 
K

Kevin Spencer

You could use a series of divs, one per record, and use CSS styles in each
div to set the margin-left style of each div according to the value of the
number. Example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled 1</title>
<style type="text/css">
..indent1 {
margin-left: 10px;
}
..indent2 {
margin-left: 20px;
}
..indent3 {
margin-left: 30px;
}
</style>
</head>

<body>

<div class="indent1">1 Mary</div>
<div class="indent2">2 John</div>
<div class="indent2">2 Joan</div>
<div class="indent3">3 Kim</div>
<div class="indent1">1 Pam</div>
<div class="indent2">2 Carmine</div>
<div class="indent1">1 Sam</div>

</body>

</html>

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Any experience you can walk away from
is a good one.
 
J

Joyce

Thanks... that seems reasonable. I look forward to trying it out. Thanks
for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top