Pages

Saturday, May 24, 2008

JMaki + JavaScript Binding listener to the widget(dojo.drawer).

Objective: is to create a listener that capture the expanding and collapsing of the widgets. you can also apply this technique in other widgets.

in your jsp page.
<script type="text/javascript" language="javascript">
function drawerListenerExpand() {                
         alert('Drawer Expand.');
             }
             function drawerListenerCollapse(Drawer Collapse) {                
                 alert('Drawer Collapse.');
             }
             function initDrawerListener(){
                 jmaki.subscribe("/dojo/drawer/onExpand", drawerListenerExpand);
                jmaki.subscribe("/dojo/drawer/onCollapse", drawerListenerCollapse);                 
             }
</script>


<a:widget name="dojo.drawer" 
     args="{rate:250, color:'blue', url:'page.jsp', title:'Drawer Sample', expanded: true}" />


- Done pretty simple your page now will capture the the event of your widgets.

No comments:

Post a Comment