Raymond Brigleb
2005-Jul-13 18:09 UTC
[Rails-spinoffs] A small question about dragging effect on sortables
Hello, I''m implementing sortables in Rails and I can''t seem to get the lovely effect from the Sortable Floats Demo on Thomas'' wonderful site: http://script.aculo.us/drag-and-drop#sortable-floats-demo Simply put, I can''t get the effect whereby you''re dragging the image. When I have a vertical or horizontal constraint on a list, the effect happens (you can see what you''re dragging then) but when I try it on images embedded in a DIV, you don''t see what you''re dragging. I''m sure I''m missing something simple, but I just can''t figure out what. Any suggestions? Thanks, Raymond
Raymond Brigleb
2005-Jul-15 20:53 UTC
[Rails-spinoffs] A small question about dragging effect on sortables
Hello again... maybe I can clarify the problem I''m having... still
stuck!
I''m writing Rails code to generate a bunch of DIVs holding thumbnails
and such. Here is the Rails code:
<%= sortable_element ''thumbholder'',
:tag => ''div'',
:overlap => ''horizontal'',
:constraint => :false,
:complete => visual_effect(:highlight,
''thumbholder''),
:url => { :action => "order" } %>
Which produces the following Javascript:
<script
type="text/javascript">Sortable.create(''thumbholder'',
{constraint:''false'', onUpdate:function(){new
Ajax.Request(''/images/
order'', {asynchronous:true, evalScripts:true, onComplete:function
(request){new Effect.Highlight(''thumbholder'',{});},
parameters:Sortable.serialize(''thumbholder'')})},
overlap:''horizontal'',
tag:''div''})</script>
I''ve tried a couple of variations... what I want is to see the images
while dragging them, but that''s not happening. I presume the
parameter I''m aiming for is constraint, and when I set it to
''vertical'' or ''horizontal'' that seems to
function correctly. But when
I set it to :false, the Javascript reads ''false'' and it
doesn''t seem
to show the DIV when I drag. I can indeed rearrange them, but I don''t
visually see the DIV I''m trying to drag.
When I look at the demonstration code on script.aculo.us, I see
constraint: false in the code (false is not quoted)... could that be
the problem? Is that a bug, or is there another way I should be
setting ''false'' in my Rails app to come out correctly in
Javascript?
Hope this makes sense! It''s a minor thing, I know, but it''s
driving
me crazy! It''s just so much prettier when you can see the dragging....
Thanks,
Raymond
On Jul 13, 2005, at 3:36 PM, Raymond Brigleb wrote:
> Hello,
>
> I''m implementing sortables in Rails and I can''t seem to
get the
> lovely effect from the Sortable Floats Demo on Thomas'' wonderful
site:
>
> http://script.aculo.us/drag-and-drop#sortable-floats-demo
>
> Simply put, I can''t get the effect whereby you''re
dragging the
> image. When I have a vertical or horizontal constraint on a list,
> the effect happens (you can see what you''re dragging then) but
when
> I try it on images embedded in a DIV, you don''t see what
you''re
> dragging.
>
> I''m sure I''m missing something simple, but I just
can''t figure out
> what. Any suggestions?
Tim Lucas
2005-Jul-15 21:49 UTC
[Rails-spinoffs] A small question about dragging effect on sortables
On 16/07/2005, at 11:11 AM, Raymond Brigleb wrote:> Hello again... maybe I can clarify the problem I''m having... still > stuck! > > I''m writing Rails code to generate a bunch of DIVs holding thumbnails > and such. Here is the Rails code: > > <%= sortable_element ''thumbholder'', > :tag => ''div'', > :overlap => ''horizontal'', > :constraint => :false,Try :constraint => false - tim