[Proto-Scripty] Re: Further constraints in sortable

2008-10-15 Thread Matt Foster

I see what you're saying now, the nested block element is the
trouble.  I can't remember exactly how it plays out, but there is a
"tree" option in the Sortable config object, you might do well to look
into that.

http://github.com/madrobby/scriptaculous/wikis/sortable



On Oct 15, 7:02 am, Lapis <[EMAIL PROTECTED]> wrote:
> Thanks for your reply!
>
> I can't think of how it would help me though. Perhaps i was unclear in
> what it is I want to do.
>
> I DO want to create sortable on ALL  elements,
> with options { tag: 'div', only: 'item' }.
>
> 
>  
>
>     A
>     B
>     C
>
>      
>         1
>         2
>         3
>     
>
> 
> 
>
> So I find all those:
>
> 
>   
>       var blocks = $$('div.block');
>       blocks.each(function (block) {
>           makeSortable(block);
>       });
>
>     function makeSortable(block) {
>         Sortable.create(
>             block
>             , {
>               tag : 'div'
>               , only : 'item'
>               // , onUpdate, onChange callbacks etc
>             }
>         );
>     }
> 
> 
>
> And *BAM* - the outermost block is created as a sortable, finding
> every div.item, even in the contained blocks of course.
> Then when the blocks.each()-loop comes to the inner blocks, they are
> created and work fine. But what does really happen with the inner
> block's divs when the outermost sortable is created? And it seems the
> outer block's divs' sortability is ruined: on some page I have this
> on, the A, B and C are not sortable after page refresh - I have to
> navigate to the page again, to do the Sortable.create stuff again, and
> this times it sticks on all the items I want to be sortable.
> Weird, but this might be something entirely different i suppose. Or
> not?
>
> What about using the 'elements' option in some way instead, extracting
> exactly the div.item:s i want for each block.div? Haven't gotten it to
> work yet, though.
>
> Still thankful for any ideas, workarounds or pointers.
> /P
>
> On Oct 14, 10:27 pm, Matt Foster <[EMAIL PROTECTED]> wrote:
>
> > Apply a more specific class to the top level element that you wish to
> > make sortable.
>
> > On Oct 14, 7:57 am, Lapis <[EMAIL PROTECTED]> wrote:
>
> > > Hi!
>
> > > I hope someone has a good idea that can help me here.
> > > I do Sortable.create(...) on some element () and
> > > pass tag: 'div' and only: 'item' in the options.
>
> > > The problem is that the element I do Sortable.create on can contain
> > > nested elements of its own kind, and the options to Sortable.create
> > > will catch every div.item, including those in the nested elements.
> > > Ugh.
>
> > > I'd like the 'only' param to be a selector i guess. Any ideas for a
> > > workaround?
>
> > > /P
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Further constraints in sortable

2008-10-15 Thread Lapis

Thanks for your reply!

I can't think of how it would help me though. Perhaps i was unclear in
what it is I want to do.

I DO want to create sortable on ALL  elements,
with options { tag: 'div', only: 'item' }.


 

A
B
C

 
1
2
3





So I find all those:


  
  var blocks = $$('div.block');
  blocks.each(function (block) {
  makeSortable(block);
  });

function makeSortable(block) {
Sortable.create(
block
, {
  tag : 'div'
  , only : 'item'
  // , onUpdate, onChange callbacks etc
}
);
}



And *BAM* - the outermost block is created as a sortable, finding
every div.item, even in the contained blocks of course.
Then when the blocks.each()-loop comes to the inner blocks, they are
created and work fine. But what does really happen with the inner
block's divs when the outermost sortable is created? And it seems the
outer block's divs' sortability is ruined: on some page I have this
on, the A, B and C are not sortable after page refresh - I have to
navigate to the page again, to do the Sortable.create stuff again, and
this times it sticks on all the items I want to be sortable.
Weird, but this might be something entirely different i suppose. Or
not?

What about using the 'elements' option in some way instead, extracting
exactly the div.item:s i want for each block.div? Haven't gotten it to
work yet, though.

Still thankful for any ideas, workarounds or pointers.
/P


On Oct 14, 10:27 pm, Matt Foster <[EMAIL PROTECTED]> wrote:
> Apply a more specific class to the top level element that you wish to
> make sortable.
>
> On Oct 14, 7:57 am, Lapis <[EMAIL PROTECTED]> wrote:
>
> > Hi!
>
> > I hope someone has a good idea that can help me here.
> > I do Sortable.create(...) on some element () and
> > pass tag: 'div' and only: 'item' in the options.
>
> > The problem is that the element I do Sortable.create on can contain
> > nested elements of its own kind, and the options to Sortable.create
> > will catch every div.item, including those in the nested elements.
> > Ugh.
>
> > I'd like the 'only' param to be a selector i guess. Any ideas for a
> > workaround?
>
> > /P
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Further constraints in sortable

2008-10-14 Thread Matt Foster

Apply a more specific class to the top level element that you wish to
make sortable.

On Oct 14, 7:57 am, Lapis <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I hope someone has a good idea that can help me here.
> I do Sortable.create(...) on some element () and
> pass tag: 'div' and only: 'item' in the options.
>
> The problem is that the element I do Sortable.create on can contain
> nested elements of its own kind, and the options to Sortable.create
> will catch every div.item, including those in the nested elements.
> Ugh.
>
> I'd like the 'only' param to be a selector i guess. Any ideas for a
> workaround?
>
> /P
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---