knockout.js

Uncaught ReferenceError: Unable to process binding with Ajax

放肆的年华 提交于 2019-12-23 20:24:24
问题 I have two layered MVC4 .NET Application with DAL and Web layers. I am having problems when trying to bind data with Ajax returned data. On Html, i am trying to get SubcriteriaList members and create the table for each member while filling their values. HTML: <h2 style="text-align:center">Criteria Info</h2> <table align="center"> <tr> <th colspan="3">Subcriteria Info</th> </tr> <tr> <td> <table class="table-condensed"> <tbody data-bind="foreach:SubcriteriaList"> <tr> <td> <table class="table

knockoutjs checked binding

大憨熊 提交于 2019-12-23 18:34:02
问题 I am having trouble with the checked binding: clicking on the checkbox doesn't update the visible status, although a dependentObservable indicates that the value has changed. Here is the HTML fragment: <input type="checkbox" data-bind="checked: document().selected" title="Select one or more documents to find more similar ones" > This is bound to an instance of my Posting class that has a document() observable. The relevant part of the document class looks like this: function Document(data,

two datepickers with knockout, one updates another

耗尽温柔 提交于 2019-12-23 17:53:28
问题 I got attached jQuery datepicker with knockout custom bindings handler, and I want to when updating first field to set minDate of second to day after (in case that other date was not set to later date). <label>Check-in:</label> <input type="date" id="checkIn" data-bind="datepicker: checkIn, datepickerOptions: { minDate: 0, dateFormat: 'dd/mm/yy', firstDay: 1 }" /> <br/> <br/> <label>Check-out:</label> <input type="date" id="checkOut" data-bind="datepicker: checkOut, datepickerOptions: {

Javascript “Expected ']'”

喜你入骨 提交于 2019-12-23 17:53:23
问题 I figure i've just been staring at my screen too long today - I can't find the error here. I've got a jQuery template and i'm using KnockoutJS's foreach on it. Inside i have a button and i'm trying to call a function onclick and pass in an iteration value. Here's the snippet from the template. The only thing that i can think would be wrong is something about my jQuery template syntax, tho it's working elsewhere <button onclick="newTabify(${$data})">Chat</button> My template looks like this...

How to consume asp.net webapi with knockout

混江龙づ霸主 提交于 2019-12-23 17:53:01
问题 I am new to knockout and asp.net webapi, but I am trying to learn. I am missing something, as i cannot perform a get(or a post,put...) here is my webapi method public string GetAllData() { List<Task> llistTask = new List<Task>(); Task lobjTask = new Task(); lobjTask.title = "some title"; lobjTask.isDone = false; llistTask.Add(lobjTask); return Newtonsoft.Json.JsonConvert.SerializeObject(llistTask); } my knockout code <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title><

knockout.js calling click even when jquery template is rendered

好久不见. 提交于 2019-12-23 17:33:56
问题 Why would the click even get fired for showFlawDetails when the template renders? app.viewModel.caseStudy.showFlawDetails = function (index) { console.log(index); app.viewModel.caseStudy.selectedFlaw(index); }; <script id="flawTemplate" type="text/html"> {{each(index, value) $data}} <div class="flaw"> <div class="Title" data-bind="click: app.viewModel.caseStudy.showFlawDetails(index)"> Flaw: ${value.Title} </div> <div class="Items" data-bind="visible: app.viewModel.caseStudy.selectedFlaw() ==

Knockout.js — understanding foreach and with

岁酱吖の 提交于 2019-12-23 17:06:37
问题 I've been going through the learn.knockout.js tutorials and been experimenting. Can someone explain why this works [ Tutorial: Single page applications, Step 2 ] (using with: chosenFolderData and foreach: mails ): <!-- Mails grid --> <table class="mails" data-bind="with: chosenFolderData"> <thead><tr><th>From</th><th>To</th><th>Subject</th><th>Date</th></tr></thead> <tbody data-bind="foreach: mails"> <tr> <td data-bind="text: from"></td> <td data-bind="text: to"></td> <td data-bind="text:

Filter Table Contents

霸气de小男生 提交于 2019-12-23 16:45:33
问题 I am looking to implement a binding to search an HTML table. I thought about implementing a custom binding and utilizing jQuery for the heavy lifting. The custom binding aspect is to make it universally accessible within my solution. My current solution consists solely of jQuery and doesn't use any KnockoutJS functionality. The problem: How can I pass in a "target" table for which to search? ko.customBindings only have access to the element which it is bound to, and I need to use an input, so

Kendo-Knockout: use knockout view model with kendo datasource

ぐ巨炮叔叔 提交于 2019-12-23 16:21:22
问题 I am doing some experiments with Kendo, Knockout and kendo-knockoutjs libraries. I want to use knockout view model with kendo datasource and to bind it to the kendo grid widget. In Kendo: html: <div id="main"> <div id="reportGrid" data-bind="source: gridDataSource"></div> </div> javascript: var billingReportViewModel = kendo.observable({ gridDataSource: new kendo.data.DataSource({data:[{name:"Apple", color:"green"},{name:"Banana", color:"yellow"}]}) }); $("#reportGrid").kendoGrid(); kendo

Knockout databind reset

ε祈祈猫儿з 提交于 2019-12-23 16:17:19
问题 I use knockout databinds on webforms. Currently I have a reset function that is used before re-loading original data to clear the form. I have over 60 fields that I need to clear and doing each one individual is a pain. Is there a way to clear all knockout bindings at once? Currently what I use is below: self.parentObject.somefield(''); self.parentObjectAddress.street1(''); etc etc -- Update 1-- To add clarification all my fields are part of a parentObject. Example self.parentObject.fieldName