i working jquery ui sortable portlets , php, , need able number position each portlet , update when moved.
the portlet in 1st position should position 1, , portlet in 2nd position should position 2.
the trick want update every time move portlet, portlet in 1st position position 1 , on. because moving unique data in these portlets, , position value determine priority information displayed on page.
so how , display portlets position on each portlet, , update whenever moved?
<script> $(function() { $( ".column" ).sortable({ connectwith: ".column", handle: ".portlet-header", cancel: ".portlet-toggle", placeholder: "portlet-placeholder ui-corner-all" }); $( ".portlet" ) .addclass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" ) .find( ".portlet-header" ) .addclass( "ui-widget-header ui-corner-all" ) }); </script> <?php for($i = 0; $i < 6; $i++){ ?> <div class="portlet" id='portlet<?php echo $i; ?>'> <div class="portlet-header"> <div>position:<span id="value<?php echo $i; ?>"></span></div> <script> $(document).ready(function() { var portletposition = $('#portlet<?php echo $i; ?>').sortable("serialize"); $("#value<?php echo $i; ?>").html(portletposition); }); </script> </div> //unique portlet data </div> <?php } ?>
Comments
Post a Comment