This topic is locked
[SOLVED]

How to create Nested selection boxes/menu

10/22/2010 1:04:15 PM
ASPRunnerPro General questions
P
plunkchr author

My users have 1000's of records referring to documents and files

In each document record, they capture document name, shortcut to document, description, keywords, short extract, etc.. about each document
I am trying to create a document / file organiser site which organises and lets users select files by different categories they would create (possibly 5 or more category levels)
i.e. I am trying to simulate the windows directory/subdirectory structure in a database
After selecting a category, a list of the record (files) appear

Users can list all resords for a category/sort by a few categories, search by category, etc...

Very similar creating nested folders in windows and accessing files via windows explorer
HOW DO YOU PROVIDE THE USER WITH A NESTED DROP DOWN LIST OF that expands based on them select a higher level category.
A bonus would be (if anyone knows how) being able to add new sub categories to a main category, on the fly without having to define a fiedl in a table for each category (e.g. if you only define 5 category fields you are stick with 5 levels of dropdown) ON a disk you can create as many subdirectories as you wish....
Even better, has anyone setup an application/template for document/file management
Any help would be greatly appreciated.

Thanks

C

Sergey Kornilov admin 10/23/2010

Lets say you have the following fields in this database table: Category, SubCategory, SubSubCategory, Filename, Description etc
You need to start by creating a set of Custom views
View1 (Categories): select distinct Category from table

View2 (SubCategories): select distinct Category, SubCategory from table

View3 (Categories): select distinct SubCategory, SubSubCategory from table

View4 (Files): select distinct SubSubCategory, Filename, Description from table
Link all view as master-details

Categories->SubCategories->SubSubCategories->Files
Now you can drill down from top category to file level and see the list of files there.

P
plunkchr author 10/26/2010

Many thanks for the very quick and detailed reply.

I had already used the solution you gave, but, unfortunatly the end users do not want to have a pre-defined restriction on the number of categories, i.e. they want to be able to create as many sub categories under a category as they want (just like creating as many windows folders/subdirectories as one wanted under a root directory/drive) i.e. imagine simulation the windows directory structure in a database.
Also, adding lots of category fields to the "table structure/record" will mean a lot of extra data being stored for each filename/description record created.
Many thanks for any help.

Regards

C

Sergey Kornilov admin 10/27/2010

If you are looking for a 100% flexible solution you need to write a few lines of code.
Each record needs to have an ID, Type (folder or file) and ParentID (ID of parent folder or NULL).
The current active folder ID needs to be stored in session variable and updated accordingly. To select files and folders that belong to current active folder only you need to use BeforeSQLQuery event. You can find sample code in this article: http://xlinesoft.com/asprunnerpro/docs/dynamic_sql_query.htm

P
plunkchr author 11/1/2010

Again, thanks for quick reply.

Yes the "ID" and "Parent ID" fields are a way of tracking dependencies of records in a hierarchial folder/directory style configuration.


My only difficulty is displaying the list of records/folders with "Windows Explorer-Like File & Folder Browsing" so a user can navigate the folder hierarchy. When a user clicks on a top level folder it displays the list of lower level folders, if user then clicks on a lower level folder, if files exist in the lower level folder these are listed.
Again, similar to the windows file explorer GUI which also shows a '+' sign beside a folder to indicate lower level folders exist (if non exist, no '+' sign is shown).

Sergey Kornilov admin 11/1/2010

I'm not really sure what's the question here.