if have set of dom elements constructed containerless foreach, possible use knockout animated transitions them? e.g. afteradd, aftermove, afterremove.
something like:
<!-- ko foreach: somelist(), afteradd: afteraddcallback --> <div>dom element list item</div> <!-- /ko -->
update: idiotically screwed test code. code below generate messages on console using either div (commented out) or virtual tags. so, yes.
ko.applybindings({ myitems: ko.observablearray(['a', 'b', 'c']), yellowfadein: function(element, index, data) { console.debug("something"); }, additem: function() { this.myitems.push('new item'); } });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script> <!--div data-bind="foreach: {data:myitems, afteradd: yellowfadein}" --> <!-- ko foreach: { data: myitems, afteradd: yellowfadein } --> <div data-bind="text: $data"></div> <!-- /ko --> <!-- /div --> <button data-bind="click: additem">add</button>
Comments
Post a Comment