Monday 15 August 2011

jquery - ko foreach not working -


I have reviewed all related artifacts which I have found, and others seem to be able to work this simple code

I am using jquery-1.9.1, jquery-mobile-1.3.0, and Knockout-2.2.1. I am providing it because I have found that many times these libraries may be incompatible. I have not got a good resource which tells which one of these libraries should be used together.

My problem is that I can tie a persuasive array using the template, but the knockout container can not be found without working for the foreach.

This works:

  & lt; Ul Data-roll = "List View" Data-Insert = "Right" Data-Bind = "Template: {name: 'OfficeTemplate', Foreign Language: CampaignTame, like: 'Team'}" & gt; & Lt; / Ul & gt; & Lt; Script Type = "Text / html" id = "OfficeTemplate" & gt; & Lt; Li & gt; & Lt; Span data-bind = "text: team name" & gt; & Lt; / Span & gt; & Lt; / Li & gt; & Lt; / Script & gt;   

This does not work:

  & lt; Ul & gt; & Lt ;! - Forwarding: Campaign Training - & gt; & Lt; Li & gt; & Lt; H1 & gt; & Lt; Span data-bind = "text: team name" & gt; & Lt; / Span & gt; & Lt; / H1> & Lt; / Li & gt; & Lt ;! - / ko - & gt; & Lt; / Ul & gt;   

This is going to be more complex and I intend to use nested templates, clean in-line binding is very popular.

I have seen debugging on it. When using Containerless Syntax, FREEBinding (VM) fails.

View Model: No. 0: // Campaign Campaign: Ko.SourceWebLay (empty)}; // Office summary $ .exax ({type: "GET", url: "/ api / salesteamdata / getofficesummary /? Campaign =" + campaign, datatype: "Jason", data: "", success: work { Vm.CampaignTeams = ko.observableArray (data); ko.applyBindings (vm); $ ('li- [data-role = collapsible]'.) Compressed ({theme: 'c', refresh: true});}, Error: function (XMLHttpRequest, textStatus, errorThrown) {warning ("Error:" + Error Instant);}});

  var vm = {// data campaign tm: Ko.SourceWeb [])}; Ko.applyBindings (VM); // Office summary $ .exax ({type: "GET", url: "/ api / salesteamdata / getofficesummary /? Campaign =" + campaign, datatype: "Jason", data: "", success: work { Vm.CampaignTeams ($) ('li [data-roll = compressed]'). Compact ({Theme: 'C', Refresh: Correct});}, Error: Work (XMLHttpRequest, textStatus, errorThrown) { Warning ("Error:" + error appears);}});    

No comments:

Post a Comment