Sharpoint Change Title Field to Hyperlink using JS Link, Open popup on click of hyperlink

(function() {

    // Create object that have the context information about the field that we want to change it output render
    var linkFiledContext = {};
    linkFiledContext.Templates = {};
    linkFiledContext.Templates.Fields = {
        //the “LinkField” is the name of the column in the list
        "URLNoMenu": {
            "View": sendForApproval
        },
    };

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(linkFiledContext);

})();

// This function provides the rendering logic for list view
function sendForApproval(ctx) {
var html ="";
var urlValue=ctx.CurrentItem["URL"];

var value=ctx.CurrentItem["URL.desc"];
if(value=="Group Report"){
    html = "<a href='#' onclick='javascript:openPopUp();'/>"+value+"</a>";
    return html;
    }
    else{
    html = "<a href='"+urlValue+"' />"+value+"</a>";
    return html
    }
   
}

function openPopUp(url) {
var value=url;
$("#docURl").val(url);
    var options = {
        title: "",     
        url: _spPageContextInfo.webAbsoluteUrl+'/_layouts/15/chkperm.aspx?obj=http%3A%2F%2F192%2E168%2E1%2E29%3A8080%2Fodp%2FTradeFunds%2CWEB&Sourc=http://192.168.1.29:8080/odp/TradeFunds/Lists/Admin/AllItems.aspx'    };
    SP.UI.ModalDialog.showModalDialog(options);
}

Comments

Popular posts from this blog

My Interview Experience

React Checkbox Control SPFx