function DeleteSelectedItem() {
var clientContext = SP.ClientContext.get_current();
var currentlibid = SP.ListOperation.Selection.getSelectedList();
if (currentlibid == null) {
alert('Please select at least one item and try again.');
window.location.href = window.location.href;
}
else {
var oList = clientContext.get_web().get_lists().getById(currentlibid);
var selectedItems = SP.ListOperation.Selection.getSelectedItems(clientContext);
if (selectedItems == '') {
alert('Please select at least one item and try again.');
window.location.href = window.location.href; //window.location.reload(true);// = window.location.pathname;
}
else {
if (confirm("Do you want to delete selected items?")) {
// RecycleSelectedItems();
/* var myItems = '';
for (var i in selectedItems) {
myItems += '|' + selectedItems[i].id;
}
myItems += '^' + window.parent.location.href;
clientContext.executeQueryAsync
(
function (sender, args) {
STSNavigate('/_layouts/EXP.FS.DeleteFiles/DeleteFile.aspx?Items=' + myItems);
}
);*/
// DeleteSelectedItem();
var myItems = '';
for (var i in selectedItems) {
myItems += '|' + selectedItems[i].id;
}
myItems += '^' + window.parent.location.href;
var options = SP.UI.$create_DialogOptions();
// options.url =getPageName+'?Items='+ myItems;
options.url = '/_layouts/EXP.FS.DeleteFiles/DeleteFile.aspx?Items='+ myItems;
options.width = .5;//500;
options.height =.5;// 400;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
}
}
}
No comments:
Post a Comment