WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 xTree and ASP..., Guillermo, March 4, 2004
     Re:xTree and ASP... , globule, March 13, 2004
     Re:xTree and ASP... , Andy, March 10, 2004
     Re:xTree and ASP..., chsw1984, March 5, 2004

Subject: Re:xTree and ASP... From: globule Date: March 13, 2004

You could also just create the javascript tree calls dynamically within ASP (via vbscript). Like so:

'TREE-SPECIFIC CODE THAT I AM REFERRING TO  'Create the root  strDynJSXTree = strDynJSXTree & "var tree = new WebFXTree(""Event Types"");"
 intCurEventID = -1  intCurSecID = -1
 '------------------------------  ' Iterate through the Recordset  '------------------------------  objRS.MoveFirst
 While Not(objRS.EOF)   If Not(intCurEventID Eqv objRS.Fields.Item(FLDNM_22).Value) Then       intCurEventID = objRS.Fields.Item(FLDNM_22).Value    strCurEventNode = "e" & intCurEventID    strCurEventNodeName = objRS.Fields.Item(FLDNM_21).Value
'TREE-SPECIFIC CODE THAT I AM REFERRING TO    strDynJSXTree = strDynJSXTree & _      "var " & strCurEventNode & " = new WebFXTreeItem(""" & strCurEventNodeName & """,""" & TREE_MSG & """);" & _     "tree.add(" & strCurEventNode & ");"   End If  

  If Not(intCurSecID Eqv objRS.Fields.Item(FLDNM_23).Value) Then         intCurSecID = objRS.Fields.Item(FLDNM_23).Value    strCurSecNode = "s" & intCurEventID & intCurSecID    strCurSecNodeName = objRS.Fields.Item(FLDNM_24).Value

'TREE-SPECIFIC CODE THAT I AM REFERRING TO    strDynJSXTree = strDynJSXTree & _     "var " & strCurSecNode & " = new WebFXTreeItem(""" & strCurSecNodeName & """);" & _     strCurEventNode & ".add(" & strCurSecNode & ");"   End If         'Next record, please...   objRS.MoveNext  Wend
'TREE-SPECIFIC CODE THAT I AM REFERRING TO  'Last line  strDynJSXTree = strDynJSXTree & "document.write(tree);"      
 strDynJS = "<script language=""javascript"">" & strDynJSXTree & "</script>"

I do all this in the <HEAD> and then drop the string that contains all the dynamically created javascript (in this case, strDynJS) in the body of the page wherever I want the tree to show up.


From: Guillermo
Sent: March 4, 2004
Subject: Re:xTree and ASP...

I was wondering if I could create a dynamic xTree using ASP within the .js file... is this possible? I want the tree to load items from a database.

My question is, will the server process the ASP within the .js file? I believe it would not, so how can I resolve this? I guess I *could* use xmlLoadTree, but then I would have to update the xml file everytime a new record is added to the database...


Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.

View All Messages
Back to WebFX