Yes. It's completely possible. As a matter of fact this is exactly what my
current web app does. Here is an outline of the 'trick'
<html>
<head>
<script language="javascript">
items = new Array()
</script>
<script language="javascript"
src="name_of_servlet/php/asp/jsp_that_produces_javascript_that_adds_items
from_database_to_items_array"></script>
<script language="javascript src="../src/dynapi.js"></script>
<script language="javascript">
theme = "../coreImages/themes/enlightenment/"
document.write('<script language="Javascript"
src="'+theme+'style.js"><'+'/'+'script>')
</script>
<script language="javascript">
DynAPI.setLibraryPath('/admin/viewbuilder/dynapi/src/lib/')
DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.event.*')
DynAPI.include('dynapi.ckslib.coreskintree')
DynAPI.onLoad = function() {
var aTree = new CoreSkinTree(30,30,200,'Database Tree',theme)
for (var i=0;i<items.length;i++)
var itm = items[i]
aTree.add(itm.name)
}
DynAPI.addChild(aTree)
}
</script>
</head>
<body>
</body>
</html>
The real 'trick' is to include an javascript file that is dynamically
generated by some server process that has access to your database and loads
info into the javascript items array (or even complex javascript objects
which are then added to the items array). Again, the important thing to
remember is that the server process MUST PRODUCE VALID JAVASCRIPT. That's
it.
Hope this helps
3V3
----- Original Message -----
From: "Scott Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 9:33 AM
Subject: [Dynapi-Help] Populating a tree from a database
> I'm a virgin (as far as DynAPI in concerned) so be gentle.
>
> Is there a way to populate a tree control from a database? Is it possible
> to dynamically update the data in the tree control?
>
> Are there any examples that show how this is done.
>
> BTW - We plan on using Turbine & Velocity (both open source) to create our
> web application framework.
>
> Thanks,
>
> Scott
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help