You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gaurav <gp...@gmail.com> on 2012/03/19 13:36:26 UTC

problem in custom javascript with scriptaculous

Hi,
I created a drop down box and want to add scriptaculous Draggable in my drop
down box but it is not working together. So how can I fix the things.

               @AfterRender
		void afterRender(MarkupWriter writer)
		{   
			 writer.end(); //end of box div
			 writer.end(); //end of container div
			 javaScriptSupport.addScript("new
DropDownBox('%s','%s','%s')",elementId,dropBoxId,elementClass);
			 javaScriptSupport.addScript( "new Draggable('%s')", dropBoxId);
			
		}

Javascript code : 

var DropDownBox = Class.create({
	    initialize:
function(targetElement,dropDownBoxElement,targetElementClass){
		   this.target = $(targetElement);
		   this.boxElement = $(dropDownBoxElement);
		   this.targetElementClass = targetElementClass;
		   Event.observe(this.target, 'click',
this.toggleBox.bindAsEventListener(this)); 
	    },
	    toggleBox : function(event){
	    	Event.stop(event);
			this.boxElement.toggle();
			this.target.toggleClassName(this.targetElementClass);
    }
});




--
View this message in context: http://tapestry.1045711.n5.nabble.com/browser-back-button-after-logout-while-using-Dispatcher-tp5537754p5576973.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: problem in custom javascript with scriptaculous

Posted by Josh Canfield <jo...@gmail.com>.
Start by saying what isn't working.
On Mar 19, 2012 5:36 AM, "gaurav" <gp...@gmail.com> wrote:

> Hi,
> I created a drop down box and want to add scriptaculous Draggable in my
> drop
> down box but it is not working together. So how can I fix the things.
>
>               @AfterRender
>                void afterRender(MarkupWriter writer)
>                {
>                         writer.end(); //end of box div
>                         writer.end(); //end of container div
>                         javaScriptSupport.addScript("new
> DropDownBox('%s','%s','%s')",elementId,dropBoxId,elementClass);
>                         javaScriptSupport.addScript( "new
> Draggable('%s')", dropBoxId);
>
>                }
>
> Javascript code :
>
> var DropDownBox = Class.create({
>            initialize:
> function(targetElement,dropDownBoxElement,targetElementClass){
>                   this.target = $(targetElement);
>                   this.boxElement = $(dropDownBoxElement);
>                   this.targetElementClass = targetElementClass;
>                   Event.observe(this.target, 'click',
> this.toggleBox.bindAsEventListener(this));
>            },
>            toggleBox : function(event){
>                Event.stop(event);
>                        this.boxElement.toggle();
>
>  this.target.toggleClassName(this.targetElementClass);
>    }
> });
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/browser-back-button-after-logout-while-using-Dispatcher-tp5537754p5576973.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.