[jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread rafald
Hi ,
please check this:
http://jsbin.com/oququ3/6/edit

As you can see:
- sortable list works
- accordion works
...but:
- POPUP 'update'  does not come

what could be wrong here?
regards
Rafal


[jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread rafald
Hi ,
please check this:
http://jsbin.com/oququ3/6/edit

As you can see:
- sortable list works
- accordion works
...but:
- POPUP 'update'  does not come

what could be wrong here?
regards
Rafal


[jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread rafald
Hi ,
please check this:
http://jsbin.com/oququ3/6/edit

As you can see:
- sortable list works
- accordion works
...but:
- POPUP 'update'  does not come

what could be wrong here?
regards
Rafal


[jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread rafald
Hi ,
please check this:
http://jsbin.com/oququ3/6/edit

As you can see:
- sortable list works
- accordion works
...but:
- POPUP 'update'  does not come

what could be wrong here?
regards
Rafal


Re: [jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread Peter Edwards

In your example, you have two calls to $('#elements').sortable().
The second one has the update event added, but the first (the one which 
creates the sortable) doesn't. If you add the update handler to the 
first call, it works OK.


on 23/02/2010 08:26 rafald said::

Hi ,
please check this:
http://jsbin.com/oququ3/6/edit

As you can see:
- sortable list works
- accordion works
...but:
- POPUP 'update'  does not come

what could be wrong here?
regards
Rafal



[jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread rafald
Hi Peter,
Indeed! It works ;-) THANKS!
It was enough to remove line with  $(#elements).sortable(); 

So, what is the right place to put:
$(#elements).sortable();
?

in my example:
the first place was outside $(document).ready(function()
the second place (where I added event) was inside $
(document).ready(function()

What are the rules  here and what will be difference if I put inside
or outside ?
Could you please explain this to me ?

regards
Rafal


Re: [jQuery] Re: Sortable list - even when list is changed

2010-02-23 Thread Peter Edwards

No problem,

$(document).ready(function(){
});

and

$(function(){
});

are the same - both will run whatever you have in them when the DOM is 
ready - the second is just a kind of shorthand for the (much easier to 
read) first. Docs:


.ready()
http://api.jquery.com/ready/

$(callback)
http://api.jquery.com/jQuery/#jQuery3

When you have multiple instances of these constructs in your scripts, 
the code within them will run in the order in which they are defined, so 
in your example, what was happening was the first 
$(#elements).sortable(); (defined within the $(function(){}); block) 
was creating the sortable list - the second call (within 
$(document).ready) was ignored.


Hope this helps,

Peter


on 23/02/2010 10:32 rafald said::

Hi Peter,
Indeed! It works ;-) THANKS!
It was enough to remove line with  $(#elements).sortable(); 

So, what is the right place to put:
$(#elements).sortable();
?

in my example:
the first place was outside $(document).ready(function()
the second place (where I added event) was inside $
(document).ready(function()

What are the rules  here and what will be difference if I put inside
or outside ?
Could you please explain this to me ?

regards
Rafal



[jQuery] Re: Sortable list - even when list is changed

2010-02-22 Thread rafald
On 22 Lut, 03:43, Nathan Klatt n8kl...@gmail.com wrote:
 Hi Rafal,

 In what way does it not work? I transcribed your code into jsbin and
 it seems to be fine, though I don't have any roundbox styling being
 applied:

 http://jsbin.com/oququ3/edit

 Nathan

Hi

I am not surpised you don't get it rounded ;-) . I presented only part
of the code for rounded corners, because this is not my problem here
(anyway: if you need rounded check this: 
http://docs.jquery.com/Tutorials:Rounded_Corners
...and make sure you download images from the style as well.).

My problem is different:
Each time when the user sorts something, I would like to see what is
the current order of items. I need to trigger a code each time when
user moves something.

In other words: I do not see popup 'update' which I expect to see
(see : alert('update')  in my code above)

What could be wrong ?

regards
Rafal




[jQuery] Re: Sortable list - even when list is changed

2010-02-22 Thread rafald
ok...I see on you page it works...I double checked my code.
Here what happens

WHEN I replace THIS:
$(function(){
$(#elements).sortable();
$(#elements).disableSelection();
});
$(function() {
$(#accordion).accordion();
});
$(document).ready(function(){
$('#elements').sortable({
   update: function(event, ui) { alert('update') }
});
$(div.roundbox) .wrap('div class=dialog'+
'div class=bd'+
'div class=c'+
'div class=s'+
'/div'+
'/div'+
'/div'+
'/div');
$('div.dialog').prepend('div class=hd'+
'div class=c/div'+
'/div')
.append('div class=ft'+
'div class=c/div'+
'/div');
});


With code from your page:

$(function(){
$(#elements).sortable();
$(#elements).disableSelection();
});
$(function() {
$(#accordion).accordion();
});
$(document).ready(function(){
$('#elements').sortable({
   update: function(event, ui) { alert('update') }
});
$(div.roundbox) .wrap('div class=dialog'+
'div class=bd'+
'div class=c'+
'div class=s'+
'/div'+
'/div'+
'/div'+
'/div');
$('div.dialog').prepend('div class=hd'+
'div class=c/div'+
'/div')
.append('div class=ft'+
'div class=c/div'+
'/div');
});



...the it WORKS ;-)

but the problem is I need accordion as well.

For my code it is enough that I remove THIS part:
$(function(){
$(#elements).sortable();
$(#elements).disableSelection();
});
$(function() {
$(#accordion).accordion();
});

then it works

so I have to reorganize the code.

Could you advise me what will be the best solution here ?

regards
Rafal


Re: [jQuery] Re: Sortable list - even when list is changed

2010-02-22 Thread Nathan Klatt
On Mon, Feb 22, 2010 at 11:10 AM, rafald rafdrepub...@gmail.com wrote:
 ok...I see on you page it works...I double checked my code.
 ...
 but the problem is I need accordion as well.

If you update the jsbin page to how you think it should be (i.e., add
the accordion) I'd be happy to look into what's wrong. :)

Go to the page I made: http://jsbin.com/oququ3/edit, make your edits,
save a New revision, then forward the link.

Nathan