Navigation - DynaTree with DB Data Format

The third kind of tree data source is from database. A GROUP BY clause is required to generate a tree structure. The firing node is the last node and it is not necessary at the same level. This example has 829 nodes. Instead of an url link, we use a JavaScript link to process the firing node. You can also use Script to submit the action.

Tree Data From DB - Node Trigger using Javascript

<!--T_ShowTree_3.aspx-->

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
   Dim tree As New Tornado.Z()
   With tree
      .dbPageSize = -1
      .dbDSN = "nwind.mdb"
      .dbCommonTables = "index=EID,FullName|sql=Select Employeeid, Firstname & ' ' & Lastname from employees"
      .dbLookUpFlds = "field=Employeeid|keyindex=EID|lookupindex=FullName"
      .dbSQL = "Select Employeeid, Orderid, customerid From orders group by Employeeid, Orderid, Customerid"

'... DB data source defined - use tree to present

      .dbTreeParams = "wi=200| he=500|mst=5| mbg=ffffff| mifp=aspdbmenuicons1.gif| sifp=aspdbmenuscroll.gif| fontsize2=11| fontname0=Verdana| fontname1=Verdana| fontname2=Verdana| fontname3=Verdana| textstyle2=1| xoffset0=4| xoffset1=4| xoffset2=4| xoffset3=3| hovercolor0=6E6E6E| hovercolor1=6E6E6E |hovercolor2=6E6E6E |hovercolor3=6E6E6E| opencolor0=FF0000| opencolor1=FF0000| opencolor2=FF0000| visitedcolor0=a5a5a5| Visitedcolor1=a5a5a5| visitedcolor2=a5a5a5| visitedcolor3=a5a5a5| nodeheight=1| Type=DB| defaultAction=javascript:alert('Employee = [[0]] : Order ID = [[1]] : CustomerID = [[2]]')"
      Response.Write(.ASPdbTree())
   End With
End Sub
</script>

 

Tree Data From DB with Long Text via ToolTip and Popup Images Display Trigger

This is a very special case of the DB tree implemented to support long text viewing. All need to be done is ti place the long text as the last query field and specify which note the long text is attached to and that's all. Note that the required GROUP BY of DB tree does not support Memo field. So you have to use Regular 256 character string field or 8000 characters VarChar field of the MS-SQL. Tornado Dynatree will format the long text into a tool tip. The following example use the ACCESS Memo field which will be truncated to a 265 characters as the long text field. We specified it is attached to node #2 ('Car' field) and also we use a JavaScript to display the image built by the JavaScript Action macro. The internal Thumbnail routine 'OpenImg' is exposed as a Public function. This JS function display the images with a size to fit window. We also turn on the 'multinodesopening' option such that you can open multiple nodes (default is open just one node).

<!--T_ShowTree_4.aspx-->

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
   Dim GD As New Tornado.Getdata()
   Response.Write(replace(GD.Get_OpenImg,"(500,500)","(380,232)"))
   Dim T As New Tornado.Z()
   T.dbDSN = "Car2000.mdb"
   T.dbSQL = "SELECT Manufacturer, yr, Car, comment FROM CarSpecs group by Manufacturer, yr, Car, comment"
   T.dbNoHead = True
   T.dbMemoTextSize = 256
   Dim Params As String = "tooltipnode=2| wi=200| he=500|mst=5| mbg=ffffff| mifp=aspdbmenuicons1.gif| sifp=aspdbmenuscroll.gif| fontsize2=11| fontname0=Verdana| fontname1=Verdana| fontname2=Verdana| fontname3=Verdana| textstyle2=1| xoffset0=4| xoffset1=4| xoffset2=4| xoffset3=3| hovercolor0=6E6E6E| hovercolor1=6E6E6E |hovercolor2=6E6E6E |hovercolor3=6E6E6E| opencolor0=FF0000| opencolor1=FF0000| opencolor2=FF0000| opencolor3=FF0000|visitedcolor0=a5a5a5| Visitedcolor1=a5a5a5| visitedcolor2=a5a5a5| visitedcolor3=a5a5a5| nodeheight=1| Type=DB| multinodesopening=on| defaultaction=Javascript:openimg('/tornado/db/images-car/[[2]].jpg',400, 200)"
   T.dbTreeParams = Params
   Response.Write("<html>" & T.ASPdbTree() & "</html>")
End Sub
</script>

So, this example use only as few properties to accomplish the very difficult task of incorporating long text into the DynaTree. Since we know the images are all 380x232 pixels, we set the popup windows size to the same resolution  for a smooth display.