Quantcast
Channel: SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 789

Quick workaround to solve issue regarding oData CRUD in Latest Chrome!

$
0
0

Hey All,

 

If you get an error as below when your do any CRUD operations using oDATA ,

 

oData.JPG

 

Open your console and execute the below code & check if your app works (don't refresh after executing this code in console) https://gist.github.com/arv/9529994

 

if (!Document.prototype.createAttributeNS) {  Document.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {   var dummy = this.createElement('dummy');   dummy.setAttributeNS(namespaceURI, qualifiedName, '');   var attr = dummy.attributes[0];   dummy.removeAttributeNode(attr);   return attr;  };
}
if (!Element.prototype.setAttributeNodeNS) {  Element.prototype.setAttributeNodeNS = Element.prototype.setAttributeNode;
}

 

If your app works like a charm , then the reason for the above error is just because Chrome has remove some DOM Level 2 API's. Internally data.js uses two functions

 

          document.createAttributeNS() ,  document.setAttributeNS()

 

which have been removed from chrome's API. The workaround code would manually add those functions to the DOM object document.

 

So, till this is fixed you can create a new js file say, workaround.js and copy the code posted above and import it to your ui5 app index.html as

 

<script src="workaround.js"></script>

 

Once this issue is resolved, you can remove the workaround script This is just one of the workaround available.

 

Regards

Sakthivel


Viewing all articles
Browse latest Browse all 789

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>