knockout.js - Breeze + Knockout bindings in graph collections -


i'm having trouble saving updates existing data graph in breezejs using knockoutjs bindings.

i began john papa's spa using hottowel & durandal.

the symptoms i'm able save updates physician record if update simple property of physician. however, if add new element in 1 of collections contained in physician can save collection element comes server , saved database null properties , without reference physician. i'm using specialty example i'm seeing same behavior collection in physician record add item to. added item comes server nulls in properties.

the physician graph displays fine on page , i'm able associate drop-downs fine appropriate values specific fields appropriate. checkboxes etc. show appropriate values.

here's segment of html i'm using:

<div id="physgraph" class="span10" data-bind="with: currentphysician()[0]">     <!-- more stuff here -->     <div id="physspecialties" class="span8">       <span class="span8">physician specialties<i class="icon-plus-sign" title="add new specialty physician" data-bind="click: $parents[0].addspecialtytophysician"></i></span>       <div class="span8 table-bordered" data-bind="foreach: physicianspecialties">         <div class="span8">           <span data-bind="text: specialty().name()"></span>         </div>         <div class="span7  table-bordered">           <i class="icon-remove-sign" title="remove specialty physician list" data-bind="click: $parents[1].removespecialtyfromphysician"></i>           <select data-bind="options: $parents[1].specialties(), optionstext: 'name', value: specialty()"></select>         </div>       </div>     </div>     <!-- more stuff here -->  </div> <!-- end with: currentphysician()[0] 

here's how i'm getting physician:

define([services/datacontext', 'viewmodels/physlist'], function (datacontext, physlistvm) {   var initialized = false;   var physnotes = ko.observablearray();   var currentphysician = ko.observable();   var vm = {     activate: activate,     title: 'physician edit',     currentphysician: currentphysician,     addspecialtytophysician: addspecialtytophysician,     save: save,     // more code in here   }    // internal functions physdetailedit    function activate() {     initlookups();     var physidselectedfromlist = physlistvm.selectedphys().id();     return getphysiciandetail(physidselectedfromlist);   }    function getphysiciandetail(requestedphysid) {     var promise = datacontext.getphysiciandetails(requestedphysid, currentphysician);     return promise;   }   more code in here } 

here's how i'm adding specialty:

  function addspecialtytophysician(item, event) {     var newitem = datacontext.createspecialty();     item.physicianspecialties.push(newitem);     // i've tried -- > currentphysician()[0].physicianspecialties.push(newitem);   } 

here's how i'm saving record:

  function save() {     return datacontext.savechanges();   } 

here's codefirst description of these 2 items:

  public class physician   {     public physician()     {       physicianspecialties = new list<physicianspecialty>();       physicianpayers = new list<physicianpayer>();       incentiveprograms = new list<physicianincentivedetail>();       physiciannotes = new list<note>();       physinorgs = new list<physinorg>();       memberships = new list<membership>();     }     public int32 id { get; set; }     public person contactinfo { get; set; }     public icollection<membership> memberships { get; set; }     public icollection<physicianincentivedetail> incentiveprograms { get; set; }     public icollection<physicianpayer> physicianpayers { get; set; }     public icollection<physicianspecialty> physicianspecialties { get; set; }     public icollection<note> physiciannotes { get; set; }     public icollection<physinorg> physinorgs { get; set; }     public string dea { get; set; }     public string npi { get; set; }     public string tin { get; set; }     public string ssn { get; set; }     public string taxid { get; set; }     public string medlicensenbr { get; set; }     public string medlicensestate { get; set; }     public datetime? medlicenserecertdate { get; set; }     public emrsystem emrsystem { get; set; }     public int importbatchid { get; set; }     public bool ispcp { get; set; }     public bool solopractitioner { get; set; }     public bool partofhospital { get; set; }   }    public class physicianspecialty   {     public int32 id { get; set; }     public physician physician { get; set; }     public specialty specialty { get; set; }     public bool isprimary { get; set; }   } 

what when save is:

id  isprimary   physician_id    specialty_id 21  0           null            null 

i'm assuming adding specialty physician graph breeze automatically insert physician id , selected specialty drop-down appears on page when push specialty onto currentphysician()[0].

can see i'm missing?

thanks

looks data saving partially not sure whether has bearing @ issue faced problem hot towel template , breeze. reason breeze source in template different after updating via nuget. try downloading breejejs , replacing source. if doesn't work no worse off. posted issue earlier

errors when using breeze ef


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -