Hi All,
In my JS code, am fetching some data from termstore.
I am loading the SP.Taxonomy.js, before executing my custom function. But in some scenarios, its not calling my custom JS function.
SP.SOD.executeFunc('SP.Taxonomy.js', false, Function.createDelegate(this, MyCustomFunction));
The custom function doesnt get called. Below is the complete code:
var taxonomySodLoaded = false;
if (typeof (_v_dictSod) !== 'undefined' && _v_dictSod['SP.Taxonomy.js'] == null) {
SP.SOD.registerSod('SP.Taxonomy.js', SP.Utilities.Utility.getLayoutsPageUrl('SP.Taxonomy.js'));
}
else {
taxonomySodLoaded = _v_dictSod['SP.Taxonomy.js'].state === Sods.loaded;
}
if (taxonomySodLoaded) {
Function.createDelegate(this, MyCustomFunction)();
}
else {
SP.SOD.executeFunc('SP.Taxonomy.js', false, Function.createDelegate(this, MyCustomFunction));
}
In some cases, the last "else" condition is executed but MyCustomFunction isnt getting triggered.
Any idea where am going wrong?
Note:This code is similar to the one posted here and marked as answer:
http://sharepoint.stackexchange.com/questions/136047/sharepoint-2013-get-all-taxonomy-terms-jsom
Thanks