Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

What is the best way to reorderng items in DOM?

$
0
0
In my app I have the can.Model.List of articles, which have attribute "position". When I changing that attribute I want that articles will reordering in a document (DOM). The easiest way is do rerender the peace of view. So in my view I have something like:
  1. {{#if someStupidVariableName}}
  2.       {{#each articles}}
  3.             <div class="articleItem">{{name}} {{date}} {{position}}</div>
  4.       {{/each}}
  5. {{/if}}
And in my code I have:
  1. ViewModel.attr('someStupidVariableName', false);
  2. ViewModel.attr('someStupidVariableName', true);
But I think there are a better way to solve this.

Viewing all articles
Browse latest Browse all 3491

Trending Articles