using actionLogModel on child items
The actionLogModel is a fine method to push or unshift new actionlogs to the current viewmodel, but how does it work for child items?
Example:
$.each(viewModel.ChildWorkItem, function (i, item) {
//Create actionlog entry for each item:
???? actionLogModel.unshift(new app.dataModels[actionLogName].recordResolved(viewModel.ResolutionDescription));
})
I am mostly familiar with C#, where you can easily check overloads and the argument syntax for methods. Checking the prototype for the actionLogModel.unshift method gives me this:
function(){var e,t=this.wrapAll(arguments);return e=Bt.apply(this,t),this.trigger(vt,{action:"add",index:0,items:t}),e}
Not exactly so friendly. arguments could be anything I guess? That's the downside of non-strongly typed languages, unless someone have a better way to check this? Or already know how to make it work for "external" items different from current work item.
Best Answer
-
james_kleinschnitz Cireson Dev, Product Owner Advanced IT Monkey ✭✭✭A viewModel by nature is used to define the data you want displayed in your view, and while we have our viewModel two way bound so that you can also modify and persist changes with the actual data model, the ChildWorkItem object is bound to the relationship not the actual data model of the related Work Item.
Basically you can't do what you are trying to do via the viewModel. However you can use the: WorkItem/BulkEditWorkItems api call to accomplish this. This is exactly what is used in work item views when you perform the bulk change status task.
5
Answers
Basically you can't do what you are trying to do via the viewModel. However you can use the: WorkItem/BulkEditWorkItems api call to accomplish this. This is exactly what is used in work item views when you perform the bulk change status task.
Thanks @james_kleinschnitz for explaining it so even I can almost understand.