Unable to cancel event from input element in knockout platform

I have an input input element like this

<input id="txtId" type="text" data-bind="value: query, valueUpdate: 'keyup'"> 

and I also have a collection that links to this entry

 <script> var terms = [{name: blah,...,... }]; var viewModel = { query: ko.observable('') }; viewModel.terms = ko.dependentObservable(function () { var search = this.query().toLowerCase(); return ko.utils.arrayFilter(terms, function (term) { return term.name.toLowerCase().indexOf(search) >= 0; }); }, viewModel); ko.applyBindings(viewModel); </script> 

I want to select the available elements, and they should appear in my input element. But the binding of an item to a collection and collection begins to change. I need to somehow break the bindings. So please help)

+4
source share
1 answer

I have resolved this issue. I created a flag (the ability to change the collection), this class is not observed and with it I can manipulate my collection)

+4
source

Source: https://habr.com/ru/post/1383988/


All Articles