将项目ID从列表webpart传递到提升的链接URL。 [英] Pass item id from list webpart to promoted links URL.

查看:89
本文介绍了将项目ID从列表webpart传递到提升的链接URL。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在嵌入式列表网页部件上方有一个嵌入了促销链接的页面。 客户希望使用提升的链接切片链接到某些自定义表单。 它非常适合插入新记录,但是当尝试选择记录
并从提升的链接启动编辑表单时,无论选择哪个记录(选中),它都会打开第一条记录。 您可以将项目ID硬编码到URL中并且它可以工作,但有没有办法获取已检查记录的列表项ID,
可以动态地将其传递给提升的链接URL?

I have a page with an embedded promoted links part above an embedded list web part.  The client wants to use the promoted links tiles to link to some custom forms.  It works great for inserting new records, but when trying to select a record and launch an edit form from the promoted links, it always opens the first record no matter which record is selected (checked).  You can hard code an item id into the URL and it works, but is there a way to get the list item id of the checked record and pass it dynamically to the promoted link URL?

推荐答案

我们可以使用

SP.ListOperation.Selection.getSelectedItems()方法
获取列表在列表值中选择的项目。该值是一个包含两个属性的对象,id和fsObjType,其中id是列表项的ID,fsObjType是项的类型:
0 =列表项或文档,1 =文件夹。

We can use SP.ListOperation.Selection.getSelectedItems() method to get the list items being selected in the list value. The value is an object that contains two attributes, id and fsObjType, where id is the ID of the list item, and fsObjType is the type of the item: 0 = list item or document, 1= folder.

脚本演示:

var context = SP.ClientContext.get_current(); 
var selectedItems = SP.ListOperation.Selection.getSelectedItems(context);





然后,我们可以使用
< a href ="https://www.w3schools.com/jquery/html_attr.asp"> attr()方法将id值添加到所有链接的属性"hrefAction"。

Then, we can using attr() method to add id value to the attribute "hrefAction" for all links.

脚本演示:

var link =


(selector).attr('hrefaction');

var newLink = link +"< selected id>" ;;
(selector).attr('hrefaction'); var newLink = link +"<selected id>";


(selector).attr('hrefaction',newLink);
(selector).attr('hrefaction', newLink);





有关如何自定义提升链接的信息:

https://开头的社会.technet.microsoft.com /维基/内容/文章/ 26522.sharepoint-2013-推广链接变化,大小包裹 - 视图 - 手柄点击事件使用-jquery.aspx排序= MostUseful和放大器;的PageIndex = 1

最好的问候,

Linda Zhang


这篇关于将项目ID从列表webpart传递到提升的链接URL。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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