javascript - jQuery sortable label click event is not working -
i created list sort few cities , using jquery-ui plugin draggable sorting. problem sorting working, when try serialize values nothing , when check chrome dev tools see following error:
error: uncaught error: cannot call methods on sortable prior initialization; attempted call method 'serialize' jquery-1.8.3.min.js:487
v.extend.error jquery-1.8.3.min.js:487 (anonymous function) jquery-ui-1.10.1.custom.min.js:6 v.extend.each jquery-1.8.3.min.js:536 v.fn.v.each jquery-1.8.3.min.js:416 e.fn.(anonymous function) jquery-ui-1.10.1.custom.min.js:6 (anonymous function) dragcity.php:365 v.event.dispatch jquery-1.8.3.min.js:1141 o.handle.u jquery-1.8.3.min.js:1061
php/html code:
<div class="row-fluid" id="sortable_portlets"> <div class="span4 column sortable"> <!-- begin portlet portlet--> <?php $lisres = mysql_query("select `cityid`, `name`, `cityodr` `tbl_city`"); $count = 1; while ($resrow = mysql_fetch_array($lisres)) { $ctynme = $resrow['name']; $ctyid = $resrow['cityid']; if ($count < 10) { $sp = "0"; } else { $sp = ""; } ?> <label class="portlet" id="drag_<?php echo $ctyid; ?>"> <?php echo $sp; echo $count . " " . $ctynme; ?> </label> <?php $count = $count + 1; } ?> </div> </div> <div id="rush"> </div>
script code:
$("label").click(function() { var sorted = $("label").sortable("serialize", {key: "drag"}); $.post("scripts/check.php", {dash: sorted}, function(data) { var res = data; $("#rush").html(res); }); });
i found answer. cannot select child elements container , sortable element @ same time. time , effort. here full answer: nest jquery ui sortables
Comments
Post a Comment