0

I'm using the code below:

Everything works just fine in IE and Chome, but when I use this code to generate my menu, I get these 2 erros in firefox.

TypeError: this.set_formDigestHandlingEnabled is not a function

TypeError: this.$1_1.itemPermMasks.customFromJson is not a function

Do anyone know why this happends and what I can do to fix it?

$(function () {
    $(".nav").on("click", ".navHeader .navItemHeader", function () {
        var ind = $(this).index();
        $(".nav .navContent .navItemContent.activeHeader").add($(".nav .navContent .navItemContent:eq(" + ind + ")")).toggleClass("activeHeader hideMe")
    })
})

var att;
function LoadNav(id, atr) {
    att = atr;
    console.clear();

    var scriptbase = _spPageContextInfo.webServerRelativeUrl + "_layouts/15/";
    att = atr;
    $("head").append('<script type="text/ecmascript" src="/_layouts/SP.Core.JS"></script>')

    $.getScript(scriptbase + "SP.js", function () {

        $.getScript(scriptbase + "SP.Taxonomy.js", function () {

            $.each(att["data-termset"].split(','), function (i, x) {
                execOperation(x);
            })
        });

    });
}
var ind = 0;
function execOperation(x) {
    var context = SP.ClientContext.get_current();

    //Current Taxonomy Session
    var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);

    //Term Stores
    var termStores = taxSession.get_termStores();

    //Name of the Term Store from which to get the Terms.
    var termStore = termStores.getByName(att["data-termname"]);


    var termSet = termStore.getTermSet(x);
    var menuHead = '';
    var menuItem = '<div class="navItemContent hideMe">' +
        '<div class="contentColumn"></div>' +
        '<div class="contentColumn"></div>' +
        '<div class="contentColumn"></div>' +
        '<div class="contentColumn"></div></div>';
    var terms = termSet.getAllTerms();
    context.load(termStore);
    context.load(termSet);
    context.load(terms);
    context.executeQueryAsync(function () {

        var mainName = termStore.$2_0.$1j_0.GetTermSet[x].$2_0.$K_0.Name;

        menuHead = '<div class="navItemHeader">' + mainName + '</div>';

        var termEnumerator = terms.getEnumerator();

        var t = termEnumerator.$8_0.sort(function (obj1, obj2) {
            return obj1.$2_0.$K_0.PathOfTerm.split(';').length - obj2.$2_0.$K_0.PathOfTerm.split(';').length
        })




        $(".nav .navHeader").append(menuHead);
        $(".nav .navContent").append(menuItem);
        $.each(t, function (i, x) {

            var name = x.$2_0.$K_0.Name;
            var path = x.$2_0.$K_0.PathOfTerm;
            var col;
            if (path.split(';').length == 1) {
                var column = (x.$2_0.$K_0.CustomProperties.Column - 1)

                var columndata = '<div class="contentColumnItem"><div class="navSubTitle">' + name + '</div><div class="navLinksContainer" data-path="' + path + '"></div></div>';
                $(".nav .navContent .navItemContent:eq(" + ind + ")").find(".contentColumn:eq(" + column + ")").append(columndata);

            } else if (path.split(';').length == 2) {
                var lastpath = path.split(';');
                var columndata = '<div class="navLink" data-subpath="'+lastpath[1]+'">' + name + '</div>';
                $(".nav .navContent .navItemContent:eq(" + ind + ")").find(".navLinksContainer[data-path='" + lastpath[0] + "']").append(columndata);
            } else if (path.split(';').length == 3) {
                var lastpath = path.split(';');
                var columndata = '<div class="navLink' + (lastpath.length == 3 ? ' n2' : '') + '" data-subpaths="'+lastpath[2]+'">' + name + '</div>';
                $(".nav .navContent .navItemContent:eq(" + ind + ")").find(".navLinksContainer[data-path='" + lastpath[0] + "'] .navLink[data-subpath='"+lastpath[1]+"']").after(columndata);
            } else if (path.split(';').length == 4) {
                var lastpath = path.split(';');
                var columndata = '<div class="navLink' + (lastpath.length == 4 ? ' n3' : '') + '">' + name + '</div>';
                $(".nav .navContent .navItemContent:eq(" + ind + ")").find(".navLinksContainer[data-path='" + lastpath[0] + "'] .navLink[data-subpaths='"+lastpath[2]+"']").after(columndata);
            }
        })

        ind++;
    });

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.