Hope someone has a better idea of the Breeze Extended elements, because I'm at a dead end! So, I created a partial class (WO_Rout) on the server side (web API using the Breeze API) and created a property called "AssetJobEqNo".
I read and followed the Breeze document here to no avail. Following the tutorial, I created a constructor for this particular WO_Rout object as follows:
var assets = function () { this.AssetJobEqNo = ''; }; var serviceName = 'cms8/workorders'; var manager = new breeze.EntityManager({ serviceName: serviceName }); var store = manager.metadataStore; store.registerEntityTypeCtor('WO_Rout', assets);
When I request my controller, this specific “AssetJobEqNo” property is sent and displayed in the client side JSON source results.
So ... here is the weird part that I cannot understand. If I run a request bound to a button on my user interface, then the IS property is loaded, and in the object that I assigned to it, BUT this is still the default value of the empty line, it never loads. Then I run the EXACT same query again, capturing the same objects again, and this time the IS value is there.
In conclusion, I am confused why this extended property of the object is not populated with the first request, but if I run the same request that it loads a second time?
Hope this all makes sense.
dataService function:
function getWorkOrder(reqNo) { if (reqNo > 0) { var query = breeze.EntityQuery.from("GetWorkOrders"); query = query.where("req_no", "==", reqNo) .expand(["WO_RtHelp.WO_Rout", "WO_RtHelp.WO_Rout.eqptmast", "WO_RtHelp.WO_Act.WO_Resources.persmast", "WO_RtHelp.WO_Act.WO_Resources.Kits", "WO_RtHelp.WO_Act.Activity", "WO_RtHelp.WO_Act.WO_Resources.customer", "WO_RtHelp.WO_Act.WO_Resources.eqptmast", "WO_RtHelp.WO_Act.WO_Resources.invsite.invmast", "WO_RtHelp.WO_Act.WO_Resources.crew"]) return manager.executeQuery(query); } else { return throwNotification('Please enter a Work Order number.'); } }
controller function for subsequent requests
function querySucceeded(data) { $scope.WorkOrder = {}; if (data.results.length === 0) { sysErrorNotification('No Work Order with System #' + $scope.workOrderSearchNumber); } else { $scope.WorkOrder = data.results[0]; $scope.myData = $scope.WorkOrder.WO_RtHelp; $('#bottomNav a[href="/WorkOrders/#woMain"]').tab('show'); resetDataSources(); $scope.$apply(); } }
I use Breeze, Angular, Q and jQuery