JSFiddle - React, Tailwind, and code Playground
by bakhshi
HTML
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js"></script>
<div data-bind='foreach:items'>
<div data-bind='text:index'></div>
</div>
JavaScript
var data = {
items: ko.obsevableArray([])
}
$(function () {
ko.applyBindings(data);
});
setTimeout(function () {
var filtered = [{
index: 1
}, {
index: 20
}, {
index: 3
}, {
index: 40
}, {
index: 5
}, {
index: 26
}, ];
filtered.sort(function (a, b) {
return a.index - b.index
});
data.items(filtered);
}, 2000)