open attachment link in a new tab in allitems.aspx
Hi
I create workflow to show attachment link as a column in allitems.aspx.
I use below link to open attachment link in pop-up window in allitems.aspx:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript"></script><script type="text/javascript">
$(document).ready(function(){
//In SharePoint OOTB list view, all 'td' will have this class 'ms-cellstyle'
$(".ms-vb2 a").click(function () {
var currentURL = $(this).attr('href');
var onclickVal = $(this).attr('onclick') || '';
if(onclickVal == '') {
currentURL = "javascript:ModalDailog('"+currentURL+"')";
$(this).attr('onclick', 'empty');
$(this).attr('href', currentURL);
}
});
});
//Function to open url in Modal Dailog
function ModalDailog(urlvalue) {
var options = {
url: urlvalue,
width: 800,
allowMaximize: true,
showClose: true,
dialogReturnValueCallback: silentCallback
};
SP.UI.ModalDialog.showModalDialog(options);
}
function silentCallback(dialogResult, returnValue) {
}
function refreshCallback(dialogResult, returnValue) {
SP.UI.Notify.addNotification('Operation Successful!');
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
</script>
I add this code to CEWB in AllItems.aspx and it’s work properly.
But this function dosen’t work in datasheet view!
How I can open attachment link in a new tab or in pop-up window in datasheet view in sharepoint list?