Hello everyone,
I recently had problems using sortable.serialize. I read this topic :
http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/680088ed886ff5c7/3fad08c892ecce47?lnk=gst&q=sortable+serialize&rnum=3#3fad08c892ecce47,
but unfortunately, It wasn''t sufficient !
Here''s the thing : I create my Sortable this way :
Sortable.create(''posts'',
{
tag:''div'',
only:''sortable'',
overlap:''horizontal'',
constraint: ''vertical'',
onChange : calcSort }
The HTML looks like that :
<div id="posts">
<div id="message2096" class="sortable">
<div id="subject"><a
href="...">...</a></div>
<div id="msg2096_pnlVis" style="display:none;">
<DIV id="centre">
<DIV id="username">
<a id="msg2096_lnkName"
href="mailto:...">...</a></DIV>
<DIV id="date"><span
id="msg2096_lblDate">20.08.2003
17:54:11</span></DIV>
<DIV id="content"><span
id="msg2096_lblMessage">...</span></DIV>
</DIV>
<DIV id="tools">
<a id="msg2096_lnkt1" >...</a>
<a id="msg2096_lnkt2" >...</a>
</DIV>
</div>
<span id="msg2096_lblMessageId"
style="DISPLAY:none">2096</span>
</div>
<div id="message2097" class="sortable">
<div id="message2097" class="sortable">
<div id="subject"><a
href="...">...</a></div>
<div id="msg2097_pnlVis" style="display:none;">
<DIV id="centre">
<DIV id="username">
<a id="msg2097_lnkName"
href="mailto:...">...</a></DIV>
<DIV id="date"><span
id="msg2097_lblDate">20.08.2003
17:55:43</span></DIV>
<DIV id="content"><span
id="msg2097_lblMessage">...</span></DIV>
</DIV>
<DIV id="tools">
<a id="msg2097_lnkt1" >...</a>
<a id="msg2097_lnkt2" >...</a>
</DIV>
</div>
<span id="msg2097_lblMessageId"
style="DISPLAY:none">2097</span>
</div>
</div>
</div>
(hope this won''t be too ugly once posted...)
When I use Sortable.serialize(''posts''), I get only
posts[]=&posts[]=&posts[]= etc.
Does anybody see what I miss ?
Thanks in advance,
Yan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---
A quick solution: just name your divs like "message_2096" and not
"message2096". The serialize function is looking for the underscore in
the
id property. This will produce a result like
"posts[]=2096&posts[]=2097"...
Another solution is to provide a different format option in sortable create:
eg:
Sortable.create(''posts'', {
tag:''div'',
only:''sortable'',
overlap:''horizontal'',
constraint: ''vertical'',
onChange : calcSort,
format: /^(.*)$/
}
/^(.*)$/ will produce "posts[]=message2096&posts[]=message2097"
/^[^\d]*(\d*)$/ will produce "posts[]=2096&posts=2097"
hth,
sigi
On 9/8/06, Yan <yan.corneille-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> Hello everyone,
>
> I recently had problems using sortable.serialize. I read this topic :
>
>
http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/680088ed886ff5c7/3fad08c892ecce47?lnk=gst&q=sortable+serialize&rnum=3#3fad08c892ecce47
> ,
> but unfortunately, It wasn''t sufficient !
>
> Here''s the thing : I create my Sortable this way :
>
> Sortable.create(''posts'',
> {
> tag:''div'',
> only:''sortable'',
> overlap:''horizontal'',
> constraint: ''vertical'',
> onChange : calcSort }
>
>
> The HTML looks like that :
>
> <div id="posts">
> <div id="message2096" class="sortable">
>
> <div id="subject"><a
href="...">...</a></div>
> <div id="msg2096_pnlVis"
style="display:none;">
>
> <DIV id="centre">
> <DIV id="username">
> <a
id="msg2096_lnkName"
> href="mailto:...">...</a></DIV>
> <DIV id="date"><span
id="msg2096_lblDate">
> 20.08.2003
> 17:54:11</span></DIV>
> <DIV id="content"><span
> id="msg2096_lblMessage">...</span></DIV>
> </DIV>
> <DIV id="tools">
> <a id="msg2096_lnkt1"
>...</a>
> <a id="msg2096_lnkt2"
>...</a>
> </DIV>
>
> </div>
> <span id="msg2096_lblMessageId"
style="DISPLAY:none">2096</span>
> </div>
> <div id="message2097" class="sortable">
> <div id="message2097"
class="sortable">
>
> <div id="subject"><a
href="...">...</a></div>
> <div id="msg2097_pnlVis"
style="display:none;">
>
> <DIV id="centre">
> <DIV id="username">
> <a
id="msg2097_lnkName"
> href="mailto:...">...</a></DIV>
> <DIV id="date"><span
id="msg2097_lblDate">
> 20.08.2003
> 17:55:43</span></DIV>
> <DIV id="content"><span
> id="msg2097_lblMessage">...</span></DIV>
> </DIV>
> <DIV id="tools">
> <a id="msg2097_lnkt1"
>...</a>
> <a id="msg2097_lnkt2"
>...</a>
> </DIV>
>
> </div>
> <span id="msg2097_lblMessageId"
> style="DISPLAY:none">2097</span>
> </div>
> </div>
> </div>
>
> (hope this won''t be too ugly once posted...)
>
> When I use Sortable.serialize(''posts''), I get only
> posts[]=&posts[]=&posts[]= etc.
>
> Does anybody see what I miss ?
>
> Thanks in advance,
>
> Yan.
>
>
> >
>
--
Siegfried Puchbauer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---
Perfect ! I didn''t notice the "format" option. actually in the doc (http://wiki.script.aculo.us/scriptaculous/show/Sortable.create) it appears only in the comments and I didn''t read them extensively. Both solutions fit my needs. thanks a lot ! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---