Replace between 2 items in observableArray - knockout
        Posted  
        
            by 
                Yojik
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Yojik
        
        
        
        Published on 2012-05-31T16:10:11Z
        Indexed on 
            2012/05/31
            16:40 UTC
        
        
        Read the original article
        Hit count: 315
        
JavaScript
|knockout
im tring to Replace between 2 items in observableArray with knockout but something is wrong..
after the replace of the items ,i will change and send the displayOrder property (in both itmems) to the server (or should i take other approach for this)
        rankDownMessage: function () {
            console.log("ranking down msg");
            var currentItemindex = viewModel.messages.indexOf(this); 
            var nextItemIndex = currentItemindex + 1;
            viewModel.messages.replace(
                 viewModel.messages()[nextItemIndex], 
                viewModel.messages()[currentItemindex]
             );
        }
only the first item changed to the second item but the second item doesnt become the first one
© Stack Overflow or respective owner