I'm stuck: Can't open window in combination with jQuery libs

912 views
Skip to first unread message

Broom

unread,
Sep 13, 2011, 12:09:54 PM9/13/11
to Prototype & script.aculo.us
Dear experts,

I want to open a window, but a popup window appears:
> ...already registered in the DOM! Make sure you use setDestroyOnClose() ...

(The libs are the most recent from prototype and jquery)

I stripped it down to the following page of code:
-------------------------
<html>
<head>

<script type="text/javascript" src="index.php_bestanden/
prototype.js"> </script>
<script type="text/javascript" src="index.php_bestanden/
window.js"> </script>
<script type="text/javascript" src="index.php_bestanden/
jquery-1.6.3.js"> </script>

<script language='javascript'>
function showWindow() {
win = new Window({className: "mac_os_x", title: "Sample", width:
200, height:150, destroyOnClose: true, recenterAuto:false});
win.getContent().update("<h1>Hello world !!</h1>");
win.showCenter();
}
</script>
</head>
<body>
<input type='button' value="Open Window" onclick="showWindow();">
</body>
</html>
-------------------------

It took me hours already. I hope someone knows what the problem is.
Tnx,

Broom

Victor

unread,
Sep 15, 2011, 5:41:56 AM9/15/11
to prototype-s...@googlegroups.com
Can you give more info? The full text in popup? What is window.js? Why you want to use both Prototype and jQuery on the same page? Where is your jQuery.noConflict()?

Broom

unread,
Sep 16, 2011, 5:54:59 AM9/16/11
to prototype-s...@googlegroups.com
Hi Victor,

Tnx for you reply. I was using Prototype for opening windows and so on, and jQuery for drag and drop functionality for rows in tables (not divs). With noConflict(), I can open a window, but then I'm missing the functionality of jQuery.
window.js is the prototype window class.
I really need to know more about Javascript, but for know I don't have time to dig in to it; I'll will find another solution.
Tnx,

Broom

Victor

unread,
Sep 19, 2011, 4:35:40 AM9/19/11
to prototype-s...@googlegroups.com
After jQuery.noConflict() all the functionality of jQuery is still accessible - just replace "$" with "jQuery" everywhere you need to use jQuery. Look at documentation.

Walter Lee Davis

unread,
Sep 16, 2011, 9:00:39 AM9/16/11
to prototype-s...@googlegroups.com
You can get rid of jQuery by using Scriptaculous instead -- no conflict possible, since Scripty is written on top of Prototype and depends on it.

To drag-sort the rows of a table, first make sure that there is a tbody tag around the rows you wich to sort, and give it an ID. Either in an unobtrusive dom:loaded listener, or an inline script block below your table, do this:

Sortable.create('id_of_your_tbody',{tag:'tr'});

You need to include a link to the scriptaculous library in your page head, and you have to give each tr an unique ID in the format string_123 (where string is anything you like, and 123 is an unique number, significant to your application). You use these IDs later on if you persist the new table order back to your database. Look at the Sortable.serialize documentation for more info about that.

Walter

> --
> You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/XhtnF14NKVoJ.
> To post to this group, send email to prototype-s...@googlegroups.com.
> To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.

Broom

unread,
Sep 20, 2011, 1:37:43 AM9/20/11
to prototype-s...@googlegroups.com
I first checked the docs and user comments, but that didn't make it really clear for me to get it working (because parts of the code are external).

Only using prototype is the best solution for sure. I changed the code to prototype with sortable, like you said Walter, and it is working now.
Both of you: tnx alot!

Broom




Reply all
Reply to author
Forward
0 new messages