Page 1 of 2

Selected Items in Related-items

Posted: 19 Feb 2019
by ksertkaya
Hi,

How do I get "just" selected items' (one or more) column value in related-item?

Screenshot_5.png
Screenshot_5.png (16.14 KiB) Viewed 2143 times
Best regards.

Re: Selected Items in Related-items

Posted: 21 Feb 2019
by AlexZver
Hi!

We are working on your issue.

Re: Selected Items in Related-items

Posted: 21 Feb 2019
by ksertkaya
Thanks a lot, I am waiting for your good news :)

Re: Selected Items in Related-items

Posted: 21 Feb 2019
by AlexZver
Hi!

I would like to clarify one moment before suggesting the solution, what do you mean by selection:

1) Filtering by changing the lookup field

2) Applying some conditions on displayed related items

3) Selecting in the Quick Edit mode:
Screenshot_138.png
Screenshot_138.png (6.15 KiB) Viewed 2129 times

Re: Selected Items in Related-items

Posted: 22 Feb 2019
by ksertkaya
Hi,

I want to get only one columns' values.

Exp: First I select 3 columns. When I click button, take colums' values. (Main2;Main3;Title4)

Is it possible?

Re: Selected Items in Related-items

Posted: 26 Feb 2019
by ksertkaya
Anyone help me?

Re: Selected Items in Related-items

Posted: 27 Feb 2019
by AlexZver
Hi!

I'm sorry for a late reply.

First of all, you should assign the custom CSS class to the Related Items control e.g. related-items. Then you can add a button to the form and add this code to the OnClick property of the button:

Code: Select all

var index = $(".related-items").find('th:contains("Title")').index() + 2;
var array = $(".related-items").find('table tr > td:nth-child('+index+')[style*="background-color: rgb(199, 224, 244);"], table tr > td:nth-child('+index+').ms-jsgrid-cell-selected-editable').find('a.ms-listlink');
var textArray=[];
for (var i=0;i < array.length; i++ ){
   textArray.push(array[i].text)
}
console.log(textArray);
Notice that you should replace "Title" with the displayed name of the column you want to be saved in the array.

Re: Selected Items in Related-items

Posted: 27 Feb 2019
by ksertkaya
Hi again,

Unfortunately not work(alert shows blank) :/ Can't we select items without edit mode?

Re: Selected Items in Related-items

Posted: 28 Feb 2019
by AlexZver
Hi!

Unfortunately, not, only in the Edit mode. Please try again in the Edit mode.

Re: Selected Items in Related-items

Posted: 16 Mar 2019
by Office365Guy
Using the code above I get the Index returned for the column I want but the Array length is still 0? What am I doing wrong.

My goal is to allow a user to Quick Edit the related items and select 1 row. I need 1 column from the selected row only.

Thanks in advance