Rubaxa:sortable help!

Hi guys, I installed rubaxa:sortable to make sortable my list of cards. Doc is confusing and I can not update correctly the order field inside my collection. For demo I don’t use users:
Collection and permissions:

UserStories = new Mongo.Collection('userStories');
UserStories.allow({
    update: function(userId, doc, fields, modifier){
        return doc;
    }
});

Sortable Server configuration:

Sortable.collections = ['userStories'];

HTML:

{{#sortable items=userStories sortField=order}}
     <div class="item">
         <div class="right floated content">
         <div class="ui button">+</div>
         </div>
             <div class="content">
                <a class="header userStoryUuid">#{{uuid}}</a>
             <div class="description">{{name}}</div>
         </div>
     </div>
 {{/sortable}}

And insertion of new item in the collection:

Template.backlog.events({
    'click #newUserStory':function(e, t){
        e.preventDefault();
        var projectId = FlowRouter.getParam('id');
        var userStoriesCount = UserStories.find({projectId:projectId}).count();
        var userStoryName = t.$('#userStoryName').val();
        var userStoryDate = new Date();
        var userStoryOrder = userStoriesCount+1;
        var data = {
            name:userStoryName,
            date:userStoryDate,
            projectId:projectId,
            order:userStoryOrder
        };
        Meteor.call('addUserStory', data);
});

So, sortable happens without console errors. But when I refresh the page the order turns back in the initial status.

I’m not sure that “order” field is correct. What I’m doing wrong??

Thanks! :wink:

Hi @arcy,

I just ran into a similar issue - the package persists inconsisten order-values (see https://github.com/RubaXa/Sortable/issues/465).

By the way: I also played around with https://atmospherejs.com/alcarus/sortably,
which gave me a similar problem.

Have you found a solution? Or did you end up using a different package?