Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

SP.SOD.executeFunc 'SP.Taxonomy.js' doesnt work in few scenarios

$
0
0

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



Viewing all articles
Browse latest Browse all 10096

Trending Articles



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