zoukankan      html  css  js  c++  java
  • Sharepoint 2010 SPListItem的显示或编辑页面删除后自定义操作

    SPListItem显示或编辑页面删除后,会跳转到List的默认视图页面,如果我们想跳转到自定义页面改如何实现?

    我们通常想到的方法是通过EventHandler的ItemDeleted事件实现,很可惜,我尝试失败(或许可以,只是我不知道具体该怎么做)。

    通过查看页面源码,我发现这个删除是通过 一个 DeleteItemConfirmation的JS方法实现的。 这样我们就可以用SPD编辑列表的DispForm和EditForm页面,重写自己的DeleteItemConfirmation方法,实现页面跳转。

    function getQueryString(name) 
        {    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");   
         var r = window.location.search.substr(1).match(reg);   
          if (r != null) return unescape(r[2]); 
          return null;   
           }
     function DeleteItemConfirmation()
        {
        
        
    var context = new SP.ClientContext.get_current();
    
    var web = context.get_web();  
    
    var list = web.get_lists().getByTitle('MeetingRoomReservedDemo');    
    
     var itemToDelete = list.getItemById(getQueryString('ID'));  
    
    
     itemToDelete.deleteObject();  
    
     context.executeQueryAsync(Function.createDelegate(this, this.Success), Function.createDelegate(this, this.Failed)); 
     
        }
        function Success() {  
    SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, ''); 
        
        }  
    function Failed(sender, args) {  
    
         alert('Failed to delete the item.');  
    
     } 
  • 相关阅读:
    python之jupyter
    python处理图片
    python之图片指纹(唯一性的)
    python之操作elasticsearch7.6.0
    elasticsearch之索引
    elasticsearch
    Nginx 出现 403 Forbidden解决方案
    centos 防火墙命令
    centos nginx常用的命令
    搭建centos nginx环境
  • 原文地址:https://www.cnblogs.com/Roy_Cao/p/2735471.html
Copyright © 2011-2022 走看看