Hi,
I'm trying to make div's in a view sortable. I initially tried
jQuery('div *').sortable()
..with no luck, and then tried the code below, using up and down buttons.
They work to move the content in the divs up or down, but clicking them
also causes form submission and page reload. I'm sure I'm missing
something, but I'd like to stop causing the page to reload when the up and
down buttons are clicked.
Thanks for any help,
-j
{{extend 'layout.html'}}
<script>src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script>
jQuery(document).ready(function() {
jQuery('.up').click(function() {
var parent = jQuery(this).parent();
parent.insertBefore(parent.prev());
});
jQuery('.down').click(function() {
var parent = jQuery(this).parent();
parent.insertAfter(parent.next());
});
});
</script>
{{=form.custom.begin}}
<div id='a'>
<button class="up">Up</button>
<button class="down">Down</button>
{{=form.custom.widget.a}}
<div id='a1'>
{{=form.custom.widget.a1}}
</div>
</div>
<div id='b'>
<button class="up">Up</button>
<button class="down">Down</button>
{{=form.custom.widget.b}}
<div id='b1'>
{{=form.custom.widget.b1}}
</div>
</div>
<div id='c'>
<button class="up">Up</button>
<button class="down">Down</button>
{{=form.custom.widget.c}}
<div id='c1'>
{{=form.custom.widget.c1}}
</div>
</div>
Click here when ready: {{=form.custom.submit}}
{{=form.custom.end}}
<button name ="cancel_button" onclick =
'window.location="{{=URL('mainhome')}}";'>Cancel</button>
<div>
request.vars
{{=BEAUTIFY(request.vars)}}
</div>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.