knockout-3.0

Typeahead.js not working in Knockout 3 foreach binding

一个人想着一个人 提交于 2020-01-22 15:42:07
问题 I updated a web app to Bootstrap 3 and Knockout 3 and consequently lost the built in typeahead that was in Bootstrap 2. I added typeahead.js and it works great unless I have a typeahead within a Knockout 'foreach' binding. I included code that works and fails below along with the Javascript code for the typeahead and Bootstrap binding. Any ideas? <form role="form"> <div class="row"> <div class="col-sm-4 form-group"> <input type="text" class="form-control sectionNames" data-bind="value: name"

Converting the form of an observable array and displaying in select list

蹲街弑〆低调 提交于 2020-01-17 06:23:42
问题 I have an observable array as below.. var myObservableArray = ko.observableArray(["Bungle","George","Zippy"]); I wish to copy the elements into another observable array but in the following format where type is always unknown.. var anotherObservableArray = ko.observableArray([ { name: "Bungle", type: "Unknown" }, { name: "George", type: "Unknown" }, { name: "Zippy", type: "Unknown" } ]); If the original myObservableArray changes, anotherObservableArray also needs to change. Any help is

How to carry the data from one viewModel to another ViewModel Knockout JS

半世苍凉 提交于 2020-01-10 05:39:08
问题 I am using the Knockout js in my single page Application,I need to carry the value of one viewmodel data to another viewModel data,So i can reduce my duplication creating same view, How i can achieve this below is my code.I got 2 different js file,which one consist of Employee ViewModel and in another Department View Model //Employee View <div class="Employee-view" data-role="view" id="employee"> <div data-role="content" > <ul> <li foreach:EmployeeData> //Onlcick of this need to navigate to

Computed stops triggering forever if dependency is inside of false branch statement

瘦欲@ 提交于 2020-01-01 16:46:08
问题 I'm faced a problem that my computed observable stops triggering after some sequence of dependency changes. Finally I found out the point: if dependency was inside of false branch statement during latest evaluation, computed will not be triggered next time even if condition became true before evaluation finished . Here is a sample: https://jsfiddle.net/sgs218w0/1/ var viewModel = new function(){ var self = this; self.trigger = ko.observable(true); self.fire = function(){ self.trigger(! self

Oracle JET: Knockout not updating variable

拟墨画扇 提交于 2019-12-24 10:59:25
问题 I have the following oracle jet and knockout html file <oj-dialog style="display:none;width: 600px;" id="addNewTag" title='Tag New Build' cancel-behavior='icon'> <div slot="body"> <div class="oj-form-layout"> <div class="oj-form oj-sm-odd-cols-12 oj-md-odd-cols-4 oj-md-labels-inline oj-form-cols-labels-inline oj-form-cols-max2"> <div class="oj-flex"> <div class="oj-flex-item"> <oj-label for="releaseVersion">Release Version</oj-label> </div> <div class="oj-flex-item"> <oj-input-text id=

How might I cancel a change to an observable array w/ Knockout 3.0?

ε祈祈猫儿з 提交于 2019-12-23 08:16:04
问题 I have a change occurring to an array. I am using Sanderson's latest array subscription method to catch the add/delete change. In this subscription is where I intend to bundle and send my request over the wire. If the request fails for any reason I want to be able to cancel any possible changes to the collection. I have verified that this subscription is hit before the change propagates so I assume there would be a way to say "STOP DON'T DO IT" however I can't figure out how. As my example...

Knockout Computed Observable Array from other Observable Arrays

女生的网名这么多〃 提交于 2019-12-23 05:09:18
问题 I am using knockout with my ASP.NET Core project to achieve following 1- I am trying to compute the sold inventory based upon opening, closing and delivery inventory of a product. I have four arrays. OpeeningInventories , ClosingInventories , DeliveredInventories and SoldInventories . I am creating these arrays identically at the server side. Each array have a number of GasProducts (model). I have created JSFiddle to show you the code. Sorry the code somewhat works in my project but it is not

Dynamically load views / templates in knockout.js

早过忘川 提交于 2019-12-23 02:31:42
问题 I have a table and I want to show it in two different ways. Different number of columns and position of its content and cells. I would like to provide users with a way to change from one to another view by just clicking a button. I started doing it by just using the visible binding, but then I realized it was not the proper way of doing it as the content was just invisible but it was still being loaded in the DOM. I was duplicating content in the background and generating invalid HTML

validation not working in knockout js

邮差的信 提交于 2019-12-12 06:59:13
问题 I am validating an input field for unique parameters for this i am using this code . self.loanterm = ko.observable().extend({ required: true,unique: { collection: self.termValues, externalValue: "" } }); but when i am adding duplicate value it doesn't showing me any message. termValues is an observable array whose values i am adding like this . self.PopulateLoans = ko.computed(function(){ ko.utils.arrayForEach(dummyData, function(item){ self.Terms.push(new Term(item)); self.termValues.push

How to can I create an array of knockout.js observables?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 04:18:11
问题 I have an array of objects for which I am showing their properties. How can add an individual edit functionality to them? Lets say it to be an edit button for each one of the elements of the list. I want to show input fields instead of text fields when the object is in edit mode, for this I am using the visible binding. So I need a Boolean observable for each of them. How can I do this without knowing the amount of elements in the list... I also have add and delete, so I would need to add