Jquery Storage Type Undefined
I used a jQuery storage to store data. oStore = jQuery.sap.storage(jQuery.sap.storage.Type.local); oStore.put('id', rep); but I am getting this error: Cannot read property 'Type'
Solution 1:
The reason, why jQuery.sap.storage
is not defined, is that the module has not yet been loaded (and thus not globally accessible). Whenever you're using jQuery APIs, make sure to resolve its dependency first, and then use the resolved parameter name instead of accessing APIs globally as mentioned in the documentation:
Use only local variables inside the AMD factory function, do not access the content of other modules via their global names, not even for such fundamental stuff like
jQuery
orsap.ui.Device
. You can't be sure that the modules are already loaded and the namespace is available.
Example:
sap.ui.define([
"jquery.sap.storage",
// ...
], function(jQuery /*...*/) {
"use strict";
const storageType = jQuery.sap.storage.Type.local;
const storage = jQuery.sap.storage(storageType);
// ...
});
Post a Comment for "Jquery Storage Type Undefined"