Skip to main content

Need help with yahoo.tree selection event handling by jmaki.dcontainer

5 replies [Last post]
moizd
Offline
Joined: 2004-09-15

Hello,

I am attempting to build a Windows Explorer like ui using jMaki: using a yahoo.tree widget in the left page and a table in a jmaki.dcontainer in the right pane. The tree contains 3 different kinds of nodes: a root node, which has parent nodes which, in turn, have child nodes. Depending on the type of node selected, I need to show a different detail table in the right pane; one for the root node, one for the parent nodes and a third one for the leaf nodes.

I have looked at the containers sample at http://jmaki.com/jmaki/containers/ and I have read Carla Mott's blog post on building Web 2.0 applications (http://weblogs.java.net/blog/carlavmott/archive/2007/08/building_web_20_...).

I have attempted all of the tips, but I can't get it to work right. I can get the dcontainer to display a different table only once. After that there is no response to any further events. I can log the events being published to the topic that the dcontainer widget is subscribed to, in glue.js.

Is there an example out there that demonstrates event handling between a tree and a dcontainer?

Any help would be appreciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
moizd
Offline
Joined: 2004-09-15

Carla,

Thank you for your response. I was only able to look at it today. Please excuse me for being dense, but there is something I don't follow:

In your example, the node WebApplications3 sends a select message to target id "webappmod". There is no such item in the dcontainer list.

Is that a typo, was the intent to send a message to target id "jdbc"?

Once I make the change, it works like a charm. Thank you.
FYI. I converted to a jsp sample as below:

<%@ page language="java" %>
<%@ page contentType="text/html" %>
<%@ page pageEncoding="UTF-8" %>

<%@ taglib prefix="a" uri="http://jmaki/v1.0/jsp" %>


subscribe="*/container"
value="{
items : [
{ id : 'commontasks', include : 'commontasks.html', iframe: true, overflowY: 'hidden', overflow : 'hidden'},
{ id : 'webapp', include : 'webapp.html', iframe : true, overflowY: 'hidden', overflow : 'hidden', lazyLoad : true},
{ id : 'jdbc', include : 'jdbc.html', iframe : true, overflowY: 'hidden', overflow : 'hidden', lazyLoad : true}
]
}" />

Regards.

sloanb
Offline
Joined: 2003-09-14

Hi moizd,

She probably copied it from another example. You are correct in that changing the included id to 'jdbc' would change the container view to that viewId. Let us know if you need anything else.

Regards,
--Sloan

castertroy
Offline
Joined: 2009-04-01

Hi,

I'm new to ajax and i'm also trying to build something like an internet explorer. I think i missed the part where we indicate which div the htmls in the container will appear... or i'm just lost :D

Any help would be appreciated.

Thanks,

-CT

carlavmott
Offline
Joined: 2005-02-10

Hi moizd,

I did something similar just a few weeks ago. I have a page with a tree that drives the content to the right. below is the code for the dcontainer that I used. Note that each time one of the nodes in the tree is clicked the dcontainer will load a page for me. The pages contain tables and other things in my app. Here I used straight html and not Java but the idea is the same. I also use an id to drive which page will be loaded.

dcontainer tag:

<div style="height:900px" jmakiName="jmaki.dcontainer"
jmakiSubscribe="*/container"
jmakiValue="{
items : [
{ id : 'commontasks', include : 'commontasks.html', iframe: true, overflowY: 'hidden', overflow : 'hidden'},
{ id : 'webapp', include : 'webApplications/index.html', iframe : true, overflowY: 'hidden', overflow : 'hidden', lazyLoad : true},
{ id : 'jdbc', include : 'jdbc.html', iframe : true, overflowY: 'hidden', overflow : 'hidden', lazyLoad : true}
]
}">
</div>

tree tag looks like:
<span jmakiName="yahoo.tree"
jmakiValue="{
root : {
label : 'Admin Console',
expanded : true,
children : [
{ label : 'Registration'},
{ label : 'Application Server'},
{ label : 'Applications ',
expanded : true,
children : [
{ label : 'Web Applications',
id: 'webapp',
action : { topic : '/container/select', message : {targetId : 'webapp'}},
expanded : true,
children : [
{ label : 'WebApplication3',
action : { topic : '/container/select', message : {targetId : 'webappmod'}}
}
]}
]
}
]
}
}></span>

hth,
Carla

castertroy
Offline
Joined: 2009-04-01

Hi Carla,

is there a way to pass parameters to commontasks.html? Instead of an html, i have a jsp which requires parameters to be loaded by request.getParameter... Hope you can point me out to the right direction

thanks