jquery ui - UI doesn't fully update with KnockoutJS and JqueryUI Sortable -


first of sorry bad english!

anyway i'm trying make simple task manager based on knockout js , jquery ui. after research found little plugin helps connect ko jqueryui's sortable, can read here: http://www.knockmeout.net/2012/02/revisiting-dragging-dropping-and.html

the plugin works quite updating order of observable array needed refresh values of elements based on position inside array. tried update whole array after each sorting , noticed strange behavior: while ui remains same, if send array json updated right values!

you can find snippet of code here: http://jsfiddle.net/ingro/mz3mk/

try move elements in sortable list , see differences between ui , values displayed "print" button.

edit: try pull first element (test#1) bottom of sortable list. attribute 'time' of element remain same (07:00). take second spot of sortable list , notice attribute 'time' became "10:00"! in fact ui refreshed when drag around, , element dragged refreshed state before dragging. if print values of array, can see refreshed :\

thanks can me on this!

as understood problem, need make time , title observable. consider updated jsfiddle

var post = function( time, title) {     this.time = ko.observable( time );     this.title = ko.observable( title ); }; 

then

self.posts = ko.observablearray( ko.utils.arraymap( posts , function( post ) {         return new post( post.time, post.title); })); 

and able use observable update syntax:

post.time(self.times()[count]); 

also may find helpful knockout todo app example todoapp


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -