문제

응용 프로그램 페이지에 세 개의 연결된 ListView 웹 파트가 있으며 각 웹 파트에서 선택한 항목에 액세스 할 수 있습니다.이것은 "확인란"에서와 같이 선택되지 않지만 필터 값을 다음 웹 파트로 전달하는 연결된 항목입니다.나는 을 시도했다

myWebPart.Connections // empty
myWebPart.FilterValue // null
myWebPart.ConnectionID // null
.

및 내 웹 파트의 사실상 모든 다른 재산.항목의 ID를 연결할 수있는 방법이 없습니다.

도움이 되었습니까?

해결책

I created three web parts connected together and filterable using Title: SharePoint online webpart connections

Choose a color -> Choose a fruit -> View fruit details.

I created the following selector (jQuery required):

$('img[alt="Selected"]').parent().next().children('div.ms-vb');

Which returns an array of the selected elements which have an ID attribute. You could then do a simple each and do the work you want with each ID.

$('img[alt="Selected"]').parent().next().children('div.ms-vb').each(function(i){
   console.log($(this).attr('id'));
});
// will give you:
// 3 (Blue)
// 2 (Blueberry)

Shows up like this in Chrome console:

SharePoint selector to find currently filtered items

I think this will work as long as the you use the Title (linked to item) column in the web parts.

다른 팁

If you use JSLink instead, I think you can connect to the items in the ListView Web Part like this:

  1. In a location of your choice (such as SiteAssets library of your site, or in _catalogs/masterpage), create new JavaScript file.
  2. In the file, add the code below
  3. In your web part, reference this JavaScript file in the JSLink setting, like ~/site/SiteAssets/news_ui.js
(function () {
 // Initialize the variables for overrides objects
 var overrideCtx = {};
 overrideCtx.Templates = {};

 overrideCtx.Templates.Fields = {
 'ID': { 'ItemID' : ctx.CurrentItem.ID } 
 };

 SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
 })();

Reference:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top