javascript - breeze error trying delete a entity -


i new in breeze , trying delete entity using code:

export var deleterow= function (selectedrow) {    isdeleting(true);    selectedrow.entityaspect.setdeleted();    (<any>datacontext).savechanges()        .done(         function () {            router.replacelocation(listurl);          })        .fail(savefailed);     //}   isdeleting(false); }; 

and datacontext is:

 export var savechanges = function () {     return manager.savechanges()         .then(savesucceeded)         .fail(savefailed);      function savesucceeded(saveresult) {             log('saved data successfully', saveresult, true);     }      function savefailed(error) {         var msg = 'save failed: ' + geterrormessages(error);         logerror(msg, error);         error.message = msg;         throw error;     } }; 

the error happend in line:

selectedrow.entityaspect.setdeleted(); 

the log (chrome console) tell about:

"uncaught error: unable parse bindings. message: typeerror: cannot call method 'dictionary' of null; bindings value: text: row.assessmenttype().dictionary().name "

the object row it's alias used in markup identify row in collection:

 <!-- ko foreach: { data: assessmentregistrations(), as: 'row' }-->                     <tr data-bind="css: { koassumptiongridviewrow: true }, style: { color: 'inherit' }">                                                            <td><small data-bind="text: row.toshortdate"></small></td>                         <td><small data-bind="text: row.fishgroup().fishgroupname"></small></td>                         <td><small data-bind="text: row.assessmenttype().dictionary().name"></small></td>                                                            <td><small data-bind="text: row.site().name"></small></td>                         <td><small data-bind="text: row.site().name"></small></td>                                                               <td></td>                                                           <td><small data-bind="text: row.assessmentfollowupstatus().dictionary().name"></small></td>                                                </tr> 

any apreciated :)

not sure issue try isolate first. i.e. without involving knockout binding try call setdeleted(). bet succeed. if so, know issue knockout binding issue.

another possibility: possible issue occurring after savechanges() call? reason why make sense given symptoms 'deleted' entity becomes 'detached' after savechanges() call , binding fail.


Comments