SP.ListOperation.Selection.getSele ctedItems(context); is not working in IE

Hi All,

Below is my full code.

I am using  list view web parts and not working in IE browser but Its working fine in Chrome.

SP.ListOperation.Selection.getSelectedItems(context); - always returns null in IE but working fine with Chrome.

<div>
<tr>
<td>
<input type='button' value='Delete Service' onclick='javascript:DeleteSelectedItems();' />
</td>
</tr>
</div>


<script language='javascript' type='text/javascript'> 
$(document).ready(function(){       

      var scriptbase = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/";
        $.getScript(scriptbase + "SP.Runtime.js",
            function () {
                $.getScript(scriptbase + "SP.Core.js",  function () {return true;});
              });

/*
$.getScript(_spPageContextInfo.webAbsoluteUrl + "/_layouts/15/SP.Runtime.js");
$.getScript(_spPageContextInfo.webAbsoluteUrl + "/_layouts/15/SP.Core.js");*/

});



function DeleteSelectedItems()
{
SP.SOD.executeOrDelayUntilScriptLoaded(itemDeleteFromList, 'SP.js');
}


function itemDeleteFromList()
{
var selectedItems = null;
var context = SP.ClientContext.get_current();
var currlist = context.get_web().get_lists().getByTitle("SourceMemory");
context.load(currlist);
selectedItems = SP.ListOperation.Selection.getSelectedItems(context);


if(selectedItems != null && selectedItems != "" )
{

if(confirm('Are you sure you want to delete the memory(s)?'))
{
var item = null;
for (item in selectedItems)
{
            var projectItem = currlist.getItemById(selectedItems[item].id);
            projectItem.deleteObject();
}
context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
else
{

}
            
}


if (selectedItems == null || selectedItems == "")
{
    alert('Please select a memory to delete.');
  return;            
}

}


function OpenNewFormPopup() { 
var pUrl = "/sites/KGS/Lists/FunctionMaster/NewForm.aspx"        
 SP.UI.ModalDialog.showModalDialog(   
     {  
       url: pUrl,
       width: 800,  
       height: 700,  
       title: "Add Service"  
     }  
   );
 }



function onQuerySucceeded() {
    
    window.location.href = window.location.href
}

function onQueryFailed(sender, args) {

    alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}

</script>


August 8th, 2014 6:41am

Hi ,

For this issue, I'm trying to involve someone familiar with this topic to further look at it.

Thanks,

Eric

Free Windows Admin Tool Kit Click here and download it now
August 12th, 2014 6:46am

We are having the same issue, SP.ListOperation is undefined. This only happens in IE for users who are not in the site Owners group. Were you able to find a solution?
December 21st, 2014 7:00pm

Anyone figure this out?  I have this issue to.
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2015 11:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics