jquery - How do I update value in field with time returned from a timer function Kendo Mobile UI -
i have view contains timing data. running javascript timer function works out elased seconds between start , stop events.
i wish update view elapsed seconds , sync time record store offilinedata.
my view template this:
<!-- tasktime template --> <script id="tasktimetemplate" type="text/x-kendo-template"> # var esecs = elapsedseconds # # elapsedtime = (esecs / 3600).tofixed() +'h'+ ('0'+esecs % 60).slice(-2)+'m'; # <h2 id="#:guid#"><i class="icon-time"></i> #: description #</h2> <ul data-role="listview" data-style="inset" style="font-size:90%;"> <p>project id: #: parentid #</p> <p>taskid #:id#</p> <p>time spent date: #: elapsedseconds #</p> </ul> </script>
my timer function run , stopped this:
$(document).ready(function(){ /* start button */ $('#start').click(function(e){ $('#timerbuttongroup').attr('data-index', 1); starttime = new date().gettime(); timer(); closesheet(); }); /* stop button */ $('#stop').click(function(e){ $('#timerbuttongroup').attr('data-index', 2); endtime = new date().gettime(); telapsedtime = (endtime - starttime)/1000; cleartimeout(t); closesheet(); }); });
i new kendo mobile ui , @ loss how tie time timer record need update.
try that:
$(document).ready(function(){ /* start button */ $('#start').click(function(e){ $('#timerbuttongroup').attr('data-index', 1); window.tmp.starttime = new date().gettime(); timer(); closesheet(); }); /* stop button */ $('#stop').click(function(e){ $('#timerbuttongroup').attr('data-index', 2); endtime = new date().gettime(); telapsedtime = (endtime - window.tmp.starttime)/1000; cleartimeout(t); closesheet(); console.log(endtime); }); });
Comments
Post a Comment