I''ve got a fairly complex sortable list, not unlike the queue on
Netflix, and I've got all the functions emulated from Netflix except
the input field on the helper element updating to say what the list
position value would be if I dropped it right then.
Any suggestions for pulling that information?
Here is my document ready function so you can see how I have it set up
at present.
$(document).ready(function() {
$("#sortable li:eq(0) p.top_btn a").hide();
$("#sortable").sortable({
axis: "y",
containment: "#queue",
opacity: "0.5",
change: function(e,ui) {
$(ui.helper).find("input.position").val("X"); //Value needs to
go
here
},
stop: function() {
$("#sortable li").removeClass("highlight_bg");
$("#sortable li:eq(0)").addClass("highlight_bg");
$("#sortable li:eq(1)").addClass("highlight_bg");
$("#sortable li p.top_btn a").show();
$("#sortable li:eq(0) p.top_btn a").hide();
var obj = $(this);
var howMany = obj.find("li");
var limit = howMany.length;
var i=0;
var thingy = "";
while(i<limit) {
thingy = "#sortable li:eq("+i+") input.position";
i++;
$(thingy).val(i);
}
var queryString = $('#update_form').formSerialize();
// the data could now be submitted using $.get, $.post, $.ajax,
etc
//$.post('myscript.php', queryString);
j=0; //again
while(j<limit) {
target = "#sortable li:eq("+j+") input.position";
j++;
newName = "init.position."+j;
$(target).attr("name",newName);
}
}
});
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---