knockout.js

Working with Knockout 'foreach' looping through multidimensional array

折月煮酒 提交于 2019-12-19 09:06:54
问题 I have a multidimensional associative array. this.items = ko.observableArray([ { name: "name1", viewable: true, children: [ { name: "name1-1", viewable: true, children: []}, { name: "name1-2", viewable: false, children: []} ] }, { name: "name2", viewable: false, children: [] }, { name: "name3", viewable: true, children: [ { name: "name3-1", viewable: true, children: []}, ] }, { name: "name4", viewable: true, children: [] } ]); The goal is to loop through this array and print out only the

selenium webdriver is clearing out fields after sendKeys had previously populated them

…衆ロ難τιáo~ 提交于 2019-12-19 08:07:30
问题 The webpage that I'm testing is using knockout. On other pages on our site that are not currently using knockout I'm not having the same problem. The scenario I have is where the page opens, I enter in various required fields and click the save button. At some point between when it enters a value in the last text field and when it clicks the save button the fields that previously had values become cleared out, and thus the script can't continue. Here is an example of the code that I'm running

Where do i put my Knockout.js Extensions when using Typescript and requirejs

自闭症网瘾萝莉.ら 提交于 2019-12-19 07:24:17
问题 I am in the process of porting some javascript code to typescript and using requirejs. I have a config.ts: //file config.ts ///<reference path="../require.d.ts" /> ///<reference path="DataLayer.ts" /> require.config({ baseUrl: '/scripts/App/', paths: { 'jQuery': '/scripts/jquery-1.9.1', 'ko': '/scripts/knockout-2.2.1', 'signalR': "/scripts/jquery.signalR-1.0.1", }, shim: { jQuery: { exports: '$' }, signalR:{ deps: ["jQuery"] }, ko: { deps: ["jQuery"], exports: 'ko' } } }); // load AMD module

Post JSON data through a form in MVC4

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-19 05:35:20
问题 I'm trying to POST a JSON object (a JSON-ified knockout model, if that's of any relevance) to my MVC controller, and have the controller return a new view. To do this, I'm sending the data with a form. The problem is that I would like to have the JSON automatically converted to a model when the controller receives it. If I were to use an AJAX call for this, var actionModel = new Object(); actionModel.Controls = ko.toJS(self.controls()); var json = JSON.stringify(actionModel); $.ajax({ url:

Post JSON data through a form in MVC4

佐手、 提交于 2019-12-19 05:35:15
问题 I'm trying to POST a JSON object (a JSON-ified knockout model, if that's of any relevance) to my MVC controller, and have the controller return a new view. To do this, I'm sending the data with a form. The problem is that I would like to have the JSON automatically converted to a model when the controller receives it. If I were to use an AJAX call for this, var actionModel = new Object(); actionModel.Controls = ko.toJS(self.controls()); var json = JSON.stringify(actionModel); $.ajax({ url:

Uncaught ReferenceError: define is not defined typescript

感情迁移 提交于 2019-12-19 05:06:09
问题 I am new to typescript, knockout and requirejs. I have created some demo using this files. Now, I want to implement some minor logic using typescript and knockoutjs. I have created 4-5 typescript files, which are imported internally. When I run the html file. I am getting the error stating. as Titled Can somebody help me on this error. What I am missing in this code. have search on google and spend quite a good time but didn't find the proper solutions. It must be related to requireJS to

is there a way of detecting whether a window resize event was caused by Android's popup keyboard?

自古美人都是妖i 提交于 2019-12-19 04:01:12
问题 I'm writing a webpage, which will fully support mobile browsers. The page currently uses KnockoutJS to dynamically recalculate component sizes (and hide some components) based on the screen (or container) size. I have a problem with the android browser: When you click on a text field, the pop up keyboard causes a screen resize, which causes KnockoutJS to (correctly) re-render the display. This momentarily causes the text field to lose focus, which pop-up keyboard to disappear. If only I could

is there a way of detecting whether a window resize event was caused by Android's popup keyboard?

℡╲_俬逩灬. 提交于 2019-12-19 04:00:56
问题 I'm writing a webpage, which will fully support mobile browsers. The page currently uses KnockoutJS to dynamically recalculate component sizes (and hide some components) based on the screen (or container) size. I have a problem with the android browser: When you click on a text field, the pop up keyboard causes a screen resize, which causes KnockoutJS to (correctly) re-render the display. This momentarily causes the text field to lose focus, which pop-up keyboard to disappear. If only I could

Bind text to property of child object

牧云@^-^@ 提交于 2019-12-19 03:45:14
问题 Using knockout.js, is it possible to bind to a property of a child object of a JSON object from the server? Specifically, if I'm given an object from the server that looks like this: var obj = { list: [ { key: "a", value: 1 }, { key: "b", value: 2 }, { key: "c", value: 3 } ], selected: { key: "", value: null } }; I create a viewModel from this javascript object via the "mapping" plugin: var viewModel = ko.mapping.fromJS(obj); And I bind list to a <select> tag like so: <select data-bind=

Durandal 2.0 custom dialog

北慕城南 提交于 2019-12-19 03:20:49
问题 I wish to make a Durandal custom dialog that adds a window frame with title and footer around an existing composable viewmodel. I have made a customModal.html template <div class="messageBox"> <div class="modal-header"> <h3 data-bind="text: title"></h3> </div> <div class="modal-body"> <!--ko compose: { model: model, template: view }--> <!--/ko--> </div> <div class="modal-footer" data-bind="foreach: options"> <button class="btn" data-bind="click: function () { $parent.selectOption($data); },