I have a problem with a list that I do not want to redirect when I click on another window (Sharepoint tool with Js)

0

I have a problem with a menu which when I clicked it redirects me to another page according to the "url" below attached photos of the answer [! [enter the description of the image here

shown this, normally when adding the url in the field the redirect, which does not, there is a plus and that is in each section of the internal menu of the last page shows children, that is to say when passing the mouse above it makes a hover step to show the code Js

    $(document).ready(function() {
    cargarHtmlMenuInt();

$(".dropdown").hover(
            function () {
                $('>.dropdown-menu', this).stop(true, true).fadeIn("fast");
                $(this).addClass('open');
            },
            function () {
                $('>.dropdown-menu', this).stop(true, true).fadeOut("fast");
                $(this).removeClass('open');
            });
});

var templateMenuPrincipal = '<li class="dropdown"><a href="{2}" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">{0}</a><ul class="dropdown-menu" role="menu">{1}</ul></li>';


function cargarHtmlMenuInt() {
var CantWebParts=$(".menu-sesion").length;

    for(var i=1;i<=CantWebParts;i++){
        $('#menu-sesion'+i).html('<div class="container null-pad990">' +
        '<nav class="navbar navbar-expand-lg navbar-light bg-menu-sec'+i+'">' +
        '<button style="padding: 9px;" type="button" class="btn btn-ribb btn-lg btn-block dropdown-toggle navbar-toggler" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="true" aria-label="Toggle navigation">' +
        'Secciones<span class="caret"></span>' +
        '</button>' +
        '<div class="navbar-collapse collapse show" id="navbarSupportedContent" style="">' +
        '<ul class="nav navbar-nav navinternas itemsMenu'+i+'" id="MenuInt'+i+'">' +
        '</ul>' +
        '</nav>' +
        '</div>');

        MenuInternas(i)    


    }

    /* $(".menu-sesion").after('<div class="container">'+
                                '<div class="row">'+         
                                           '<div class="col-auto mr-auto null-pad"><button type="button" class="btn btn-lg btn-success"><i style="margin-right: 16px;" class="fa fa-caret-left"></i>Volver</button></div>'+
                                           '<div class="col-auto null-pad dropdown  dropright">'+
                                                '<a href="#" role="button" id="socialbuttons" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="compartir"><i class="fa fa-share-alt fa-green-2"></i>'+
                                                    'Compartir</span></a>'+
                                                    '<div class="dropdown-menu menu-widthInternas" aria-labelledby="socialbuttons" style="margin-top: 152px;margin-left: 70rem;">'+
                                                      '<a class="dropdown-item social-shared" href="#" onclick="return shareOriginal();"><i class=" social-icon fa fa-facebook"></i></a>'+
                                                      '<a class="dropdown-item social-shared" href="#" id="shared_twitter" target="_blank"><i href="#" class=" social-icon fa fa-twitter"></i></a>'+
                                                      '<a class="dropdown-item social-shared" href="#" id="shared_wpp" target="_blank"><i href="#" class=" social-icon fa fa-whatsapp"></i></a>'+
                                                      '<a class="dropdown-item social-shared" href="#" data-toggle="popover" title="Enlace" id="enlace" data-content="http://areametropolitana.softwareestrategico.com" data-placement="bottom"><i href="#" class="social-icon fa fa-link"></i></a>'+
                                            '</div>'+
                                       '</div></div></div>'); */
}

function MenuInternas(k){

    var lista=$(".PTituloMenuI"+k).val();
    var categoria=$(".PCategoriaMenuI"+k).val();

    var SinColor=$(".PSinColorMenuI"+k).children().is(':checked');

    if(SinColor){
        $(".bg-menu-sec"+k).css('background-color','#fff')
        $("#menu-sesion"+k).css('background-color','#fff')      
    }else{
        $(".bg-menu-sec"+k).css('background-color','#ddd')
        $("#menu-sesion"+k).css('background-color','#ddd')
    }

    var aDirectos=getData(lista, "<Query><Where><Eq><FieldRef Name='categoria' /><Value Type='Lookup'>"+categoria+"</Value></Eq></Where><OrderBy><FieldRef Name='orden' Ascending='True' /></OrderBy></Query>");

    var listPadres=[];
    var Menu=[];
    $(aDirectos.responseXML).SPFilterNode("z:row").each(function() {
        Menu.push({'Title':$(this).attr("ows_Title"),'Url':$(this).attr("ows_url"),'idPadre':$(this).attr("ows_padre"),'ID':$(this).attr("ows_ID")})    
    });

    $.each(Menu, function (i, val) {

        if (val.idPadre == undefined) {
            listPadres.push(val);
        } 
    });

    $.each(listPadres, function (i, val) {
        var urls;
        if (val.Url == undefined) {
            urls = "#";
        } else {
            urls = val.Url;
            }


        $(".itemsMenu"+k).append(String.format(templateMenuPrincipal, val.Title, getHijos(val,Menu),val.Url));
    }); 

   // $("#menu-sesion .nav > li").css('width',100/listPadres.length+'%')
}


function getHijos(r,Menu) {

    var hijo = "";

    $.each(Menu, function (i, val) {
        var urls;
        if (val.Url == undefined) {
            urls = "#";
        } else {
            urls = val.Url;
        }
        if (val.idPadre != undefined && val.idPadre.split(';')[0]== r.ID) { 
            var nietos = getHijos(val);

            if (nietos != "") {
                hijo = hijo + "<li><a target='_blank' href='" + urls + "'>" + val.Title + "</a><ul>" + nietos + "</ul></li>";
            } else {
                hijo = hijo + "<li><a target='_blank' href='" + urls + "'>" + val.Title + "</a></li>";
            }
        }
    });
    return hijo;
}

this is the code of the js at the beginning of the code where the var templateMenuPrinciapl is where the issue of the url affects but I have not managed to find the change, I know it is extensive but I need your help thanks!

    
asked by Joe Pulgarin 07.09.2018 в 18:27
source

0 answers