在Sharepoint 2013上,如何在使用JS链接或Jquery选择任何项目后显示删除链接? [英] On Sharepoint 2013, How to show Delete Link after select on any item using JS link or Jquery?

查看:55
本文介绍了在Sharepoint 2013上,如何在使用JS链接或Jquery选择任何项目后显示删除链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

根据要求,

我必须在任何sahrepoint列表中选择后显示删除链接/库项目。

I have to show the Delete Link after select on any sahrepoint list/library item.

如果我点击删除链接导航到Justification页面。最终用户提供删除该项目的理由,然后点击提交。

If i click on the Delete link navigate to Justification page.There end user provide justification for Delete that item and click on submit.

提交后,电子邮件将触发管理员。

After submitting it,email will trigger to the Admin.

让我知道如何使用Visual Studio / Workflow执行此功能?

Let me know how to do this functionality with out Visual Studio/Workflow?

推荐答案

您好

示例脚本删除列表视图中的选定列表项以供参考。

<script type="text/javascript">
        function deleteSelectedItem() {
            var context = SP.ClientContext.get_current();
            var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);            
            var list = context.get_web().get_lists().getByTitle("ListB");
            var item;
            for (item in selectedItems) {
                var itemID = selectedItems[item].id;
                var listItem=list.getItemById(itemID);
                listItem.deleteObject();
            }
            context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
        }
        function onQuerySucceeded() {

            alert('Success');
            location.reload();
        }

        function onQueryFailed(sender, args) {

            alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        }
    </script>
    <input id="Button1" onclick="deleteSelectedItem()" type="button" value="button" />

根据您的要求,您可以获取列表项目ID并将其作为参数传递给其他页面然后删除。

最好的问候,

< span style ="font-size:10.0pt; line-height:105%; font-family:'Arial',sans-serif;颜色:#2F5597"> Lee


这篇关于在Sharepoint 2013上,如何在使用JS链接或Jquery选择任何项目后显示删除链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆