Want to create direct link to Document Set folders, so found and changed CSR that do this. Works well, but not in Datasheet View (it is not clickable in Datasheet View).
Tried to change column types from 'Text' to 'Hyperlink' and 'Calculated'(Text/Integer), but no result. For calculated(integer) field looks like disabled, and when I click it does nothing. In standard views it works Ok..
Can I generate clickable link in Datasheet view?
Here is CSR code that I use:
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function () {
function getBaseHtml(ctx) {
return SPClientTemplates["_defaultTemplates"].Fields.default.all.all[ctx.CurrentFieldSchema.FieldType][ctx.BaseViewID](ctx);
}
function init() {
// url of the library that contains document sets
var myDocumentSetLibraryUrl = "/Sites_Documentation/";
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
"View_Files": {
View: function (ctx) {
var dsLinkArray = [];
var lookupField = ctx.CurrentItem["Related_Folder"]; // Lookup field to Document Set
if (lookupField && lookupField.length > 0) {
var lookupValue = lookupField[0].lookupValue;
console.log(lookupValue);
var dsLinkUrl = myDocumentSetLibraryUrl + "Forms/Document%20Set/docsethomepage.aspx?RootFolder=" + myDocumentSetLibraryUrl + lookupValue;
var dsLink = "<a href = '" + dsLinkUrl + "' target=_blank'>" + lookupValue + "</a>";
dsLinkArray.push(dsLink);
return dsLinkArray.join('');
}
return "";
}
}
},
},
ListTemplateType: 100
});
}
RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens("~siteCollection/Style Library/doc_set_csr.js"), init);
init();
});