I'd probably start with a table like yours. Then for my maintenance
screen, it would likely be something like
1) click a link to "manage locations"
2) List the top level locations. Provide a link to "add a location at
this level", a link to "edit this location's details (such as name,
etc), and a link to "go deeper" within a specific location... I may
spend some time thinking about better words to use for the end user, but
you get the idea, I'm sure.
Then, basically it is the same thing only each time they go deeper, you
display that level's items with regards to the level they clicked on.
I hope that makes sense, as I haven't convinced myself it is very easily
readable.
I don't know if this pattern has a name already - it seems like simple
recursive composition to me, but I like the analogy you came up with. =)
-Sam
Phillip Senn wrote, On 11/3/2006 6:08 PM:
A few months ago, back when I thought I had a handle on this cfc
thing, I posted the code to what I thought would be a model ColdFusion
component.
One kind reader (whose name will go unmentioned (Matt)), replied
gently correcting practically every single line of code except
</cfcomponent> and then whimsically stated "The rest looks ok to me!"
So I'm back for more fun and merriment at my own expense, but this
time with what is probably a design pattern.
If I were to name it, I would call it the "Russian Doll" design
pattern, after the little dolls that are inside other dolls.
OK, so since I think it's better to speak in code instead of through
analogies, I've created a SQL script and posted it to:
http://www.aacr9.com/RussianDoll
Q: How would you put together a maintenance screen for a location
table, where a location is in another location?
Feel free to rename any fields to conform to the new OO way of thinking.
I understand that using the word "Parent" is passé.
My plan is to develop the cfm and cfc pages for this particular type
of table layout.
Here's an abbreviated view:
LocationID,Type,Name,ParentID
1 Country USA 0
2 Region North-East 1
3 Region South 1
4 Region MidWest 1
5 Region West 1
6 State New York 2
7 State Connecticut 2
8 State Maine 2
9 State Alabama 3
10 State Florida 3
11 State Georgia 3
12 State California 5
13 State Washington 5
14 State Oregon 5
15 City Albany 6
16 City Poughkeepsie 6
17 City Hartford 7
18 City New Haven 7
19 City Augusta 8
20 City Portland 8
21 City Montgomery 9
22 City Tuscaloosa 9
23 City Olympia 14
24 City Portland 14
25 Store myStore 24
26 Floor 1st Floor 25
27 Floor 2nd Floor 25
28 Room Dining 27
29 Room Kitchen 27
So then I would want to show in a dropdown:
Dining, 2nd Floor, myStore, Portland, Oregon, West, USA.
Kitchen, 2nd Floor, myStore, Portland, Oregon, West, USA.
Running the SQL code will speak better than me explaining it.
Go to http://www.aacr9.com/RussianDoll
And see what I'm trying to do.
You are subscribed to cfcdev. To unsubscribe, please follow the
instructions at http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]