Я пытаюсь прочитать clob, который в основном XML из Oracle DB и заполнен в AngularJS UI Grid. Я делаю то же самое с JSON и работает отлично.
JSON ответ от бэкэнда
{"events":{"ORDER_NO":"BBY01-100000709661","ORDER_HEADER_KEY":"2020040811522311790607 ","CREATETS":"2020-04-08 11:52:47","TMPLT_NM":"EOMS_0195 ","EMAIL_XML":"<email CommunicationType=\"Email\" SourceSystem=\"OMS\" TemplatePageZone=\"\" brand=\"BESTBUY\" channel=\"BESTBUY\" emailAddr=\"test.tester@bestbuy.com\" template=\"EOMS_0178_TEST\"><name firstName=\"Test\" lastName=\"\" middleInitial=\"\"/><order ATGID=\"ATG28268080246\" IsSuppressRequired=\"Y\" LoggedInFlag=\"Y\" LoyaltyID=\"0160140134\" OrderName=\"MSFTAllAccess\" PartyID=\"123456\" PriorityNumber=\"160140134\" customerPhoneNo=\"6515554321\" hasActivatedDevice=\"N\" orderDate=\"01/28/2020\" orderHeaderKey=\"2020012813423582265743\" orderIdATG=\"BBY01-1MT2010012802\" orderStatusLinkDisplayFlag=\"Y\" orderTotal=\"0.00\" orderTotalMinusCoupons=\"0.00\" partnerID=\"\" partnerOrderNo=\"MAV513281qweq1\" salesSource=\"BBYC\" shippingTotal=\"0.00\" taxTotal=\"0.00\"><creditCard cardType=\"\" number=\"\"/><digitalCoupons digitalCouponTotal=\"0.00\"/><lineItems><lineItem CustPromiseDate=\"02/26/2020\" CustPromiseType=\"InHandDate\" availabilityMsg=\"\" beginEstArrivalDate=\"02/24/2020\" conditionVariableOne=\"\" conditionVariableTwo=\"\" description=\"Microsoft Surface Pro 3 12 Intel Core i7 256GB Silver\" endEstArrivalDate=\"02/26/2020\" expectedShipDays=\"\" format=\"\" giftPackaging=\"N\" inHandDate=\"02/26/2020\" itemID=\"\" itemShortDesc=\"Microsoft Surface Pro 3 12 Intel Core i7 256GB Silver\" lineItemProductTotal=\"0.00\" lineItemShippingCost=\"0.00\" merchClass=\"\" modelNo=\"1000186097\" orderLineKey=\"2020021911334791500160\" oversizeFlag=\"\" pickupDate=\"\" preOrder=\"\" primeLine=\"1\" productLine=\"6.403.635\" quantity=\"1\" releaseDate=\"\" reshipReasonCode=\"RESHIP_DAMAGED_ITEM\" shipDate=\"\" shippingMethod=\"\" signatureRequiredFlag=\"N\" sku=\"9248206\" status=\"\" subLine=\"1\" tax=\"0.00\" total=\"0.00\" unitPrice=\"0.00\" unitShippingCost=\"0.00\"><shippingAddr city=\"RICHFIELD\" line1=\"1000 W 78TH ST\" line2=\"\" state=\"MN\" zip=\"55423\"><name firstName=\"Test\" lastName=\"Tester\" middleInitial=\"\"/></shippingAddr><allowance allowanceAmt=\"0.00\" reason=\"\"/><return date=\"\" lineQty=\"\" lineTotal=\"0.00\" productCredit=\"0.00\" reason=\"\" restockingFee=\"0.00\" shippingCredit=\"0.00\" taxCredit=\"0.00\"/><cancel backOrderExtendedXNumDays=\"\" reason=\"\"/><ros actualDeliveryDate=\"\" pickupDate=\"\"/><store storeName=\"\" storeNum=\"\"/><psp plan=\"\"/><carriers><carrier los=\"\" name=\"\" quantity=\"\" trackingNum=\"\"/></carriers></lineItem></lineItems><makeGood makeGoodFlag=\"N\"/></order><account atgProfileId=\"\" cirisID=\"\" info=\"\" password=\"\"/><comments/></email>"}}
Всякий раз, когда я пытаюсь прочитать значения, это вызывает исключение " newRawData.forEach не является функцией в Grid.modifyRows
Angular код:
var app = angular.module('app', ['ngTouch', 'ui.grid.selection', 'ui.grid', 'ui.grid.cellNav', 'ui.grid.edit', 'ui.grid.resizeColumns', 'ui.grid.pinning', 'ui.grid.moveColumns']);
app.controller('MainCtrl', ['$scope','$http', function ($scope, $http) {
$scope.show = 1;
$scope.close = false;
$scope.gridOptions = {
enableRowSelection: true,
enableSelectAll: true,
selectionRowHeaderWidth: 35,
rowHeight: 35,
showGridFooter:false,
enableFiltering: false,
enableHighlighting: false,
enableColumnResizing: false,
enableColumnMenus: false,
//enableHorizontalScrollbar: 0,
columnDefs: [
{ name:'ORDER_NO',displayName: 'ORDER_NO', field: 'ORDER_NO', width: '16%'},
{ name:'ORDER_HEADER_KEY',displayName: 'ORDER_HEADER_KEY', field: 'ORDER_HEADER_KEY', width: '16%' },
{ name:'TMPLT_NM', displayName: 'TMPLT_NM', field: 'TMPLT_NM', width: '25%'},
{ name:'EMAIL_XML' ,displayName: 'EMAIL_XML', field: 'EMAIL_XML',width: '36%'},
{ name:'CREATETS' ,displayName: 'CREATETS', field: 'CREATETS', width: '16%'}
]};
$scope.pricelist={};
$scope.getPriceList= function(){
if(($scope.pricelist.orderNo == "undefined")||($scope.pricelist.orderNo == null)||
($scope.pricelist.orderNo == undefined)||($scope.pricelist.orderNo == "") ){
$scope.close = true;
$scope.responseMessage = "";
$scope.gridOptions.data.pop( { });
$scope.errorMessage = "Please enter Order No!!";
}else if(($scope.pricelist.environment == "undefined")||($scope.pricelist.environment == null)||
($scope.pricelist.environment == undefined)||($scope.pricelist.environment == "")){
$scope.close = true;
$scope.responseMessage = "";
$scope.gridOptions.data.pop( { });
$scope.errorMessage = "Please select an environment!!";
}else{
var url= "/Dashboard/rest/email/" + $scope.pricelist.orderNo + "/" + $scope.pricelist.environment + "/details";
/* }else{
var url= "http://localhost:8080/Dashboard/rest/order/headerkey/" + $scope.pricelist.orderHeaderKey;
*/}
$("#loader").show();
$http.get(url).then(function(response) {
if(response.data.events == null || response.data.events == undefined ||
response.data.events == "undefined"){
$("#loader").hide();
$scope.close = true;
$scope.responseMessage = "";
$scope.gridOptions.data.length=0;
$scope.errorMessage = "Order not found!!!!";
}else{
$("#loader").hide();
var responseNew = JSON.stringify(response.data.events);
$scope.gridOptions.data = responseNew;
$scope.mySelectedRows = $scope.gridApi.selection.getSelectedRows();
$scope.close = true;
$scope.errorMessage = "";
$scope.responseMessage = "Order details fetched successfully";
}
}, function(response) {
$("#loader").hide();
$scope.close = true;
$scope.responseMessage = "";
$scope.gridOptions.data.length=0;
});
};
$scope.closeAlert = function(){
$scope.close=!$scope.close;
};
$scope.clearMessage = function(){
$scope.close = false;
$scope.responseMessage = "";
$scope.errorMessage = "";
$scope.gridOptions.data.length=0;
$scope.pricelist.environment = "";
$scope.pricelist.orderNo = "";
}
$scope.gridOptions.multiSelect = true;
$scope.info = {};
$scope.toggleMultiSelect = function() {
$scope.gridApi.selection.setMultiSelect(!$scope.gridApi.grid.options.multiSelect);
};
$scope.toggleRow1 = function() {
$scope.gridApi.selection.toggleRowSelection($scope.gridOptions.data[0]);
};
$scope.gridOptions.onRegisterApi = function(gridApi){
//set gridApi on scope
$scope.gridApi = gridApi;
};
}]);
Спасибо за помощь