I. Wide application of catalog trees
For this content, search for Search on Baidu, the content is a big pass, the relevant actually doesn't. Search? Is it not a clear use? The management of the resource manager folder, the management of multi-level forums in the forum, the AWT in Java is the lack of components such as the tree directory are limited ... Who is so rude, no face is not given? , How do I talk about? Clear clear:
In our project, the self-associated data table often occurs, from the overall look, the entire table is presented as a tree data structure. When we display this table, when we do not adopt a good expression, it will be very awkward, and the tree directory is obviously a good idea.
(The ax is a circle, I feel good, then talk ...) In the tree directory in the web, the tree directory can be implemented with JavaScript, but some details are issued, such as tree directory (click on a child node, open the associated link) , Multi-level catalogs and nodes increase, delete, and drag are subject to various elbows. In fact, the third-party control is obviously a good idea. Second, about Zhi Island directory tree control
Ok, our protagonist today - a lightweight honest catalog tree control (download address: http://www.oapro.com/ostarocx/download/otree.ocx) appeared. It uses VC 6.0 development, which is a standard OCX control, which can be applied to the programming language such as VB, VC, PB, DEPHI, ASP, JSP, etc. in a Windows environment. It uses an XML file as an interface file, which can be an off-the-shelf file or a dynamically generated XML format file (in other words can be based on the database dynamically generated directory tree node). Pisd Island directory tree control supports the replication, movement, renaming, and permission controls of nodes, and does not limit the number of layers of the directory. Introduced so much, I want to try it. In the ASP, small test cattle knife first:
Third, registration add control
Registered Zhi Island directory tree control
Download (Download Address: http://www.oapro.com/ostarocx/download/otree.ocx) After the That Otree.ocx is Otree.ocx, register the control as follows: Click "Start" → "Run"; enter the following command in the Run dialog: Regsvr32
2. Add a Zhimam directory tree control in the page
Add the following code to the page, you can insert the Zi Island directory tree control:
XML document format
XML is a good stuff, but it is also necessary to meet a certain format, otherwise the control can not be recognized! Here is a XML document format:
xml version = "1.0" encoding = "gb2312"?>
Below is an XML format document source code: XML version = "1.0" encoding = "gb2312"?>
Inform the Zi Island directory tree control through the following statement: Otree.OpenXMLFile (") in the quotient path of the XML document, for example: Otree.OpenXMLFile (" c: /otree.xml ") is shown in the following image: I have seen you frequently nod, but I murmire: If you want to generate a tree directory according to the content of the database ...? Oh, let's go to the topic (the text in front of dare to be a lot of words? Who is ? Hey ..., small voice point, don't let Xiaobian see): Fourth, Based on Database Generation Stroke Directory
XML document format
Put the node of the tree directory into the database and dynamically form a good foundation for our tree directory. Of course, some directory trees are data structures in a database (the parent node is the database name, the child node is a data sheet). Anyway, with the previous foundation, now we need to do just to form the contents of the database above the XML document. There is an ASP source code below to form an XML document in the database, where the variable DataSource stores the passed database name.
XML Version = "1.0" encoding = "GB2312"?>
At this time, the interface method is different from the XML document directly: Otree. Httpget ("http://www.oapro.com/ostarocx/sample/dataman/otree.asp", "Datasource = Otree. MDB ")] The method httpget has two parameters. The first parameter is the web page address of the implementation database conversion XML format described above. Be sure to use the relative or absolute path (because the method is not yet supported by the current method" ), The second parameter is the parameter passed to the file, where we passed the database name. According to the above introduction, you quickly realize a tree directory, point the root node, expand, parent node, expand, then click ..., 咦, how can you not respond? What react do you want? Oh, I am sorry, I almost forgot to introduce: V. Response node event
Zhi Island Tree Catalog Control provides an interface method to respond to node events: eventtree, stritemdata, stritemTyMName, StriteMName Name StriteMData Node Data StriteMType Node Type These three parameters are provided by the Zhi Island tree directory control. Developers for us to call. We can trigger events through scripts, the following is an example code: