SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Pavel_Nedved's Avatar
    Join Date
    Aug 2004
    Location
    Victoria, BC
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Script.aculo.us Ajax.Updater, Sortable.create

    Hi,

    I've got a problem with sortables in script.aculo.us.

    Basically, I have one main page, that uses Ajax.Updater to request another page. The page that it requests uses Sortable.create on a list of items. When that page gets loaded into the main page, the sortable list doesn't work. When I load it up normally by typing in the actual web address for the page, the sortables work great.

    I'm not sure where to even begin with this. Any ideas?


    Thanks,

    Pavel
    Last edited by Pavel_Nedved; Sep 13, 2006 at 20:26.

  2. #2
    SitePoint Addict Pavel_Nedved's Avatar
    Join Date
    Aug 2004
    Location
    Victoria, BC
    Posts
    229
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it!

    Here's what was wrong.

    The "new page" was called in using window.onload = function { Ajax.Update... };

    Here's the new code:

    Code:
    function doRequest() {
    	var req = new Ajax.Request('example.php',{onComplete:show_response});
    }
    
    function show_response(t) {
        $('content').innerHTML = t.responseText;
        Sortable.create('divContainer',{tag:'div'});
    }
    
     window.onload = function() { doRequest(); };
    Basically before the code was trying to add the Sortables on an element that wasn't yet written in the DOM (content hadn't loaded yet). Now we wait, get the response, then add the Sortables.

    Good work me

    Hope that helps someone,


    Pavel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •