"html sortable" + "html updater"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

"html sortable" + "html updater"

Jeremy Shute
Hi,

Has anyone made a draggable list where the elements are added via "html updater"?

After I click on a link that updates the contents, the list is no longer draggable it seems.  Is there something I need to do for the sortable stuff to understand that the DOM has changed?

Jeremy

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: "html sortable" + "html updater"

Lukas Renggli
> After I click on a link that updates the contents, the list is no longer
> draggable it seems.  Is there something I need to do for the sortable stuff
> to understand that the DOM has changed?

Yes, you need to remove the sortable before updating (actually it is
not really necessary, but it keeps the browser fast and clean) and
recreate the sortable afterwards. The sortable needs this to update
all the assigned event handlers, the cached list of elements, etc.

You can do it with something like this:

(html sortable
    id: 'sortable';
    destroy) ,
(html updater
    id: 'whatever';
    callback: [ :r | " do whatever modifies the sortable " ];
    onSuccess: (html sortable
         id: 'sortable')   " recreate the sortable (a factory method
would be better) "

HTH,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: "html sortable" + "html updater"

Jeremy Shute
Now would be a good time to mention that:

SUSortable>>destory

...is a typo for...

SUSortable>>destroy

:-)  Still acting on the rest of the advice.  Thanks!

Jeremy



On 12/13/06, Lukas Renggli <[hidden email]> wrote:
> After I click on a link that updates the contents, the list is no longer
> draggable it seems.  Is there something I need to do for the sortable stuff
> to understand that the DOM has changed?

Yes, you need to remove the sortable before updating (actually it is
not really necessary, but it keeps the browser fast and clean) and
recreate the sortable afterwards. The sortable needs this to update
all the assigned event handlers, the cached list of elements, etc.

You can do it with something like this:

(html sortable
    id: 'sortable';
    destroy) ,
(html updater
    id: 'whatever';
    callback: [ :r | " do whatever modifies the sortable " ];
    onSuccess: (html sortable
         id: 'sortable')   " recreate the sortable (a factory method
would be better) "

HTH,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: "html sortable" + "html updater"

Lukas Renggli
> SUSortable>>destory
>
> ...is a typo for...
>
> SUSortable>>destroy
>
> :-)  Still acting on the rest of the advice.  Thanks!

Yep, that's a common typo I usually do. There were (maybe still are) a
couple of those bugs in the code, be aware ;-)

Now what I would like is a Lint rule doing some spell checking on
class-names, selector-names, category-names and strings within the
code of course.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: "html sortable" + "html updater"

Jeremy Shute
Hmmm, I'm still having some difficulty with this new approach, as well.

It seems that upon creating the new sortable object, with the same ID for the span it was connected to the first time, the list is again not reorderable.

It seems that when the Sortable.create function is called in Javascript, it is BEFORE the updater changes the contents.  Altering SULibrary>>dDragDrop to alert the elements as they are visited, I see that there are one fewer list elements visited than should exist after pushing the button.  Only then does the redraw happen.

How might I alter the order of events, such that the updater does its magic, THEN onSuccess is called, THEN the Sortable.create is created?

Jeremy



On 12/13/06, Lukas Renggli <[hidden email]> wrote:
> SUSortable>>destory
>
> ...is a typo for...
>
> SUSortable>>destroy
>
> :-)  Still acting on the rest of the advice.  Thanks!

Yep, that's a common typo I usually do. There were (maybe still are) a
couple of those bugs in the code, be aware ;-)

Now what I would like is a Lint rule doing some spell checking on
class-names, selector-names, category-names and strings within the
code of course.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: "html sortable" + "html updater"

Jeremy Shute
onSuccess needs to be onComplete, then everything works.  :-)

I may get the hang of this Scriptaculous stuff, yet.

Thanks for the help,

Jeremy



On 12/13/06, Jeremy Shute <[hidden email]> wrote:
Hmmm, I'm still having some difficulty with this new approach, as well.

It seems that upon creating the new sortable object, with the same ID for the span it was connected to the first time, the list is again not reorderable.

It seems that when the Sortable.create function is called in Javascript, it is BEFORE the updater changes the contents.  Altering SULibrary>>dDragDrop to alert the elements as they are visited, I see that there are one fewer list elements visited than should exist after pushing the button.  Only then does the redraw happen.

How might I alter the order of events, such that the updater does its magic, THEN onSuccess is called, THEN the Sortable.create is created?

Jeremy



On 12/13/06, Lukas Renggli <[hidden email]> wrote:
> SUSortable>>destory
>
> ...is a typo for...
>
> SUSortable>>destroy
>
> :-)  Still acting on the rest of the advice.  Thanks!

Yep, that's a common typo I usually do. There were (maybe still are) a
couple of those bugs in the code, be aware ;-)

Now what I would like is a Lint rule doing some spell checking on
class-names, selector-names, category-names and strings within the
code of course.

Lukas

--
Lukas Renggli
<a href="http://www.lukas-renggli.ch" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: "html sortable" + "html updater"

John Rubier
Jeremy Shute wrote:
> onSuccess needs to be onComplete, then everything works.  :-)
>
> I may get the hang of this Scriptaculous stuff, yet.
>
> Thanks for the help,
>
> Jeremy
Thanks to both of you! I had been trying to get this working a few week
ago but had given up and resorted to the "Add reloads entire page"
method to add a line item to a sortable list.

btw, fyi, there is no need to call destroy (or destory) if the element
was already a sortable. Create implicitly calls destroy if that is the
case (according to the docs and it seems to works that way in practice).

Thanks again!

John

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside