hi,
remember ajax stands for asynchronous jax. this means that when you call any
ajax.* the update can be delayed.

this means that when you call your ajax.Updater class, the update is
initialized but is not yet completed when you start your populate your style
variable, and maybe even not ready when you call your
 'createLineItemSortables' function.

For this to work correctly you should use the onComplete callback from
ajax.updater, check the akjax.options API docs about it:
http://prototypejs.org/api/ajax/options

Why is this working if you ibnsert the alert() message, well by inserting
this you create a delay between the ajax call and the call to your
createsortablefunction, this gives the ajax request the time to fully
finish.


it will be something like this (untested):
ew Ajax.Updater('searchResultsStations',
                                        '/matest/api/callLetters.php',
                                        { method: 'get', parameters:
$('panelForm').serialize(true), onComplete: function() {
       styleObj = document.getElementById('searchResultsStations').style;
       styleObj.display = 'block';
       createLineItemSortables();
} } );

regards,
Maikel

On Sun, Oct 12, 2008 at 11:08 PM, Team SPAM! <[EMAIL PROTECTED]> wrote:

>
> I'm trying to make a page that get some HTML from an Ajax.Updater call
> and make the results sortable items. If I put an alert call into my
> javascript function which calls the Updater then that sortables work.
> If I take out the alert call then the page will be updates with new
> data, but they won't be sortable. Any idea why this might be happening
> and how I can get this to work without the alert call? Thanks
>
> function getSearchResultStations() {
>        //destroyLineItemSortables();
>
>        new Ajax.Updater('searchResultsStations',
>                                         '/matest/api/callLetters.php',
>                                         { method: 'get', parameters:
> $('panelForm').serialize(true) } );
>        styleObj = document.getElementById('searchResultsStations').style;
>        styleObj.display = 'block';
>
>        alert("getSearchResultStations");
>        createLineItemSortables();
> }
>
> function createLineItemSortables() {
>        for(var i = 0; i < sections.length; i++) {
>                Sortable.create(sections[i], {tag:'div', dropOnEmpty:true,
> containment:sections, only:'lineitem'});
>        }
> }
>
> function destroyLineItemSortables() {
>        for(var i = 0; i < sections.length; i++) {
>                Sortable.destroy(sections[i]);
>        }
> }
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to