1
Good afternoon, I wanted to 'break' a list of items in 3 columns of 4 items in a knockoutJS foreach.
That is, at this point the list is filled down and I would like it to be started via jQuery or javascript, because CSS is not supported in IE9
I appreciate the help !
var lbx = {};
var json = {
"items": [{
"key": 13,
"value": "A. E. Brehm"
}, {
"key": 14,
"value": "Achille Murat"
}, {
"key": 15,
"value": "Adolphe Siret"
}, {
"key": 16,
"value": "Adrien Balbi"
}, {
"key": 18,
"value": "Albereto de Oliveira"
}, {
"key": 19,
"value": "Alberto dos Reis"
}, {
"key": 20,
"value": "Albino Forjaz de Sampaio"
}, {
"key": 21,
"value": "Alexandre Dumas"
}, {
"key": 22,
"value": "Alexandre Herculano"
}, {
"key": 23,
"value": "Alfredo França"
}, {
"key": 24,
"value": "Allen Ginsberg"
}, {
"key": 25,
"value": "Alphonse Allais"
}],
"totalItems": 261
};
lbx.vm = {
term: ko.observableArray(),
};
lbx.vm.term.push(json);
console.log(lbx.vm.term());
$(function() {
ko.applyBindings(lbx.vm);
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="list-unstyled" data-bind="foreach: term">
<ul data-bind="foreach: items">
<li data-bind="text: value">
</li>
</ul>
</div>
@Rodrigoguiotti think this is it? If you’re wrong, help me. I’m new to the forum.
– Leonardo Coelho
This is exactly what I wanted, thanks for your help!
– Query