knockout.js

Modify Validate Observable of editable table in KnockoutJS

余生颓废 提交于 2019-12-13 07:56:07
问题 I'm actually doing my project the editable grid, my data comes from the JSON and parsed to dictionary to have key and value and display on the table. I have one more column to have 3 links, Modify, Validate and Cancel. However, the value from input tag, after editing by user, cannot be updated to the label tag. <table class="table table-hover"> <tbody data-bind="foreach: $root.testParams(parameters())"> <tr class="data-hover"> <td> <strong> <span id="key_params" data-bind="text:$data.key" />

A custom bindingHandler's return value/observable

自闭症网瘾萝莉.ら 提交于 2019-12-13 07:45:59
问题 I have not been able to find a solution for this. I'm trying to create a custom bindingHandler for a click event on an html element div tag. // custom bindingHandler and observable <div data-bind="OnClickEvent: HasBeenClicked"></div> // to show observable's true/false value <span data-bind="text: 'Observable: ' + HasBeenClicked()"></span> This bindingHandler does what it is suppose to, if you click on the div the text will change. However, the observable says if false . ko.bindingHandlers

Knockout binding - select first filled object

泄露秘密 提交于 2019-12-13 07:41:20
问题 I have the following KnockoutJS code in order to make a databinding for a Addresses Form Editor where I can have 4 address types ("home", "office", etc). http://jsfiddle.net/mxgFQ/1/ Right now everything is working great but the selectedAddress is being hardcoded to be the index 0 self.selectedAddress = ko.observable(self.addresses[0]); Instead of doing this I want to selected the first address object that has data filled in. Any clue on how to do this? Appreciate. 回答1: Knockout's utility

Raising an Ajax event after knockout rendering is done? (explained with screenshots)

拜拜、爱过 提交于 2019-12-13 07:39:42
问题 <div data-bind="style: { display: isShortlisted() === false ? 'inline-block' : 'none'}"> <form id="shortlistForm" action="@MVC.GetLocalUrl(MVC.HireOrgJobApplication.AjaxShortlist(Model.Application))" method="post" style="display:inline;"> @Html.AntiForgeryToken() <input type="hidden" name="ApplicationKey" value="@Model.Application.ApplicationKey" /> <button type="submit" class="btn-act jui-tooltip" title="Shortlist"> <i class="fa fa-2x fa-star"></i> </button> </form> </div> <div data-bind=

DukeScript: How do native calls into JavaScript work?

丶灬走出姿态 提交于 2019-12-13 07:25:36
问题 I'm struggling to understand how "native method" calls in DukeScript work. In particular, the ones where no body is specified in the @JavascriptBody annotation. For example: @JavaScriptResource(value = "userEntryComponent.js") public final class UserEntryWidget { private UserEntryWidget() { } @JavaScriptBody(args = {}, body = "") public static native void registerComponent(); } Where is the "registerComponent()" method defined? In knockout there's a javascript function called "ko.components

Automate mapping of dependent properties in knockout

送分小仙女□ 提交于 2019-12-13 07:23:42
问题 I have a list of product options each with an sku identifier that is received as JSON from the server. I then have other options which depend on prerequisite values being selected, this is defined by the requires array property of the product-option arrays: var serverOptions = [{ name: "DELL R210", price: 100, sku: 1001, },{ name: "DELL R710", price: 200, sku: 1002, },{ name: "DELL R720 Dual CPU", price: 300, sku: 1003, }]; var osOptions = [{ name: "Windows Standard", sku: "201", price: 1, },

Knockout Validation on Breeze.js entities

ε祈祈猫儿з 提交于 2019-12-13 07:15:03
问题 I'm trying to get Knockout Validation running on my Breeze.js entities but not having much luck. So currently I'm just trying to get a very basic test working to confirm the approach should work but am stumped as to why this is not even working. Essentially I have something like the following running when the user edits one of my entities in an attempt to register knockout validation on the resulting entity from breeze: dataService.getEntity(selectedRowId()) .then(function(result) {

Push the values of input button in an observable array using knockout

醉酒当歌 提交于 2019-12-13 07:10:09
问题 I am trying to complete a task where I choose the values of buttons and then using two way data binding I print them. My starting code is: <table class="table"> <tr> <td><input type="button" value="1" data-bind="click: addNumber"></td> <td><input type="button" value="2" data-bind="click: addNumber"</td> <td><input type="button" value="3" data-bind="click: addNumber"></td> <td><input type="button" value="4" data-bind="click: addNumber"></td> <td><input type="button" value="5" data-bind="click:

knockout Interdependent variables

家住魔仙堡 提交于 2019-12-13 07:01:37
问题 I have knockout variables that are Interdependent . Exempla : var _CostNoVAT = ko.observable(0); var _CostIncludeVAT = ko.observable(0); var _VAT= 0.50; if the user Change the _CostNoVAT to 10 then _CostIncludeVAT need to be 15 (10*(1+VAT) if the user Change the _CostIncludeVAT to 10 then _CostNoVAT need to be 6.66 (10/(1+VAT) How can I do it? regards, yaniv abo 回答1: You can do this by turning one of the observables into a writeable computed. Here, _CostIncludeVAT is a writeable computed.

Knockout binding of a Dynamically generated Dropdown options [closed]

倖福魔咒の 提交于 2019-12-13 06:59:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have 2 Dropdownlists. Both are data-bound through knockout. I am trying to achive 2 things here: The first dropdown is Certification , the second dropdown is Specialization . The second dropdown should by default have 'Please select Specialization' as an option which is not happening. It is happening for the