knockout.js

knockout component widget template requirejs html

≯℡__Kan透↙ 提交于 2019-12-23 05:16:06
问题 im implementing the widget example for knockout http://knockoutjs.com/documentation/component-overview.html loading template from external html with requirejs not working for me ko.components.register('like-or-dislike', { template: { require: 'text!files/component-like-widget.html' } }); i put the html containing the template in external html. replace "files/" with my relative path "/views/_leyout" and it's not working i need a text.js file that loads the html? any example ? 回答1: The answer

Calling rejectChanges on a entity with collection of complexTypes doubles the complexTypes in collection

余生颓废 提交于 2019-12-23 05:15:38
问题 This may be something I am doing wrong, but I am having an issue that I believe is repeatable. It may be by design, but right now I can't figure out how to get around it. I have an entity with a few complexType arrays on them. If I push a new complexType into the array, I see the correct number of objects in the collection. If I call rejectChanges on the parent entity, it removes the new complexType but then copies all of the objects in that array. Sample metadata - metadataStore

Triggering Redraw causes columns to be hidden

社会主义新天地 提交于 2019-12-23 05:15:14
问题 I have a plnk that demonstrates my issue: http://plnkr.co/edit/bXINbDBIMb0LbLitHGbl. There is a list of Tasks, each Task can contain a list of Tasks. Tasks can only be a top level or have a single parent and a Task can not contain itself. When I use the foreach binding the tasks are "saved" to the correct task and works as expected. (Other than the footable features) (Saved is in quotes because Tasks are not really saved other than being pushed to the observable array.) According to this

Knockout.js Binding to dropdownlist

微笑、不失礼 提交于 2019-12-23 04:35:06
问题 Trying to bind data to a dropdown list, function EmailTemplate(data) { var self = this; self.etId = ko.observable(data.email_template_id); self.etTypeId = ko.observable(data.email_template_type_id); self.etTitle = ko.observable(data.email_template_title); self.etContent = ko.observable(data.email_template_content); self.etAppYear = ko.observable(data.app_year); self.etSubject = ko.observable(data.subject); self.etActive = ko.observable(data.active); } function EmailTemplateViewModel() { var

Knockout sliding images issue with custom binding

喜夏-厌秋 提交于 2019-12-23 04:26:33
问题 I want to implement scrolling images on my product listing page when a user hovers on the product tile. Initially the first image will be displayed and when hovered the slide show shall begin. Each product tile will have different number of images for slide show. Issue: When hovered on an image with five images in an array, the slide show starts and second image is shown.But the instead of third image again first image is getting displayed. Below is the sequence: Number denotes the index of

How to combine ko.js and jQuery to fade in dynamically bound DOM objects?

怎甘沉沦 提交于 2019-12-23 03:51:44
问题 I let us say that I have the following HTML: <input data-bind="value: numberOne, valueUpdate: 'afterkeydown'" /> <p/> <input data-bind="value: numberTwo, valueUpdate: 'afterkeydown'" /><p/> <span data-bind="text: comp"></span> <ul data-bind="foreach: stuff"> <li><span data-bind="text: name"></span></li> </ul> and the following ViewModel in ko.js. function myVm() { var self = this; var counter = 0; var myArray = new Array(5); for(i = 0; i < myArray.length; i++){ myArray[i] = { name: "Blah "+(

Karma: Is it possible to load JavaScript files statically before the requirejs framework?

情到浓时终转凉″ 提交于 2019-12-23 03:20:06
问题 I'm wondering if it's possible to configure Karma (0.10.9) to load certain JavaScript files before its requirejs framework? The reason I'm asking is that Knockout registers as a module with RequireJS if the latter has been included before Knockout, and this breaks another module (which doesn't support RequireJS). Basically, our karma.conf.js looks as below: module.exports = function (config) { config.set({ basePath: "Scripts", frameworks: ['mocha', 'requirejs'], files: [ "knockout-2.2.1.debug

How to auto-update selected item in dropdown to all the connected clients in SignalR with Knockout.js?

a 夏天 提交于 2019-12-23 02:43:18
问题 SOLVED : Added the new corrected lines of code and commented the old ones. For a real-time application using SignalR , i want changes made by a user to be visible in real-time by all the connected clients. It's ok with a simple textbox , but when i use a dropdown list : when a user select an item, i want the selected item from dropdown to be automatically set (auto-updated) to all connected clients. Knockout.js seems to be the obvious choice, but i think i have a problem on subscribe... or

Knockout radio button binding with boolean

那年仲夏 提交于 2019-12-23 02:39:14
问题 As per this Fiddle I created when you run it it does not bind the value to "no Blue" option as expected. var viewModel = { isBlue: ko.observable(false) //isBlue: ko.observable("false") this works }; As I have mentioned in there when I pass a string value "false" it does the binding. It's clear that knockout does type comparison as well. In my application I am using komapper which creates the view model. For properties in boolean it creates bool values and initialises variables in bool. Do I

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