jquery - Sortable using 2 parameters javascript -


i using sortable sorting entries. works fine simple position numbers , when drag , drop entry can update position number , display accordingly. problem when user drags entry want update parameter time.

i have created jsfiddle demo here can have more idea of problem.

initially looks fine

enter image description here

but when drag entries updates position number , not time. want time updated well.

enter image description here

as suggested alex, should call calculatetime again. change rather grabbing data input again, can store input in variable , grab data variable.

//here set stored variable var stored_starttime, stored_minuteperround;  $(document).ready(function() {    $("#timing").click(     function() {       //here set value of stored variable       stored_starttime = document.getelementbyid("stime").value;       stored_minuteperround = document.getelementbyid("rounds").value;       calculatetime(stored_starttime, stored_minuteperround);     }   ); });  $("#sortable_nav").sortable({   placeholder: "ui-state-highlight",   helper: 'clone',   sort: function(e, ui) {     $(ui.placeholder).html(number($("#sortable_nav > li:visible").index(ui.placeholder)) + 1);   },   update: function(event, ui) {     var $lis = $(this).children('li');     $lis.each(function() {       var $li = $(this);       var newval = $(this).index() + 1;       $(this).children('.sortable-number').html(newval);       //here check if stored variables defined       if (stored_starttime !== undefined && stored_minuteperround !== undefined){         calculatetime(stored_starttime, stored_minuteperround);       }      });   } }); $("#sortable_nav").disableselection(); 

here jsfiddle http://jsfiddle.net/zjhez393/5/


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -