Dynamically Hide Column in Related-Item

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

17 Jan 2020

Hello,

Is there any way dynamically hide column in related-item?
Screenshot_38.png
Screenshot_38.png (15.75 KiB) Viewed 3563 times

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

20 Jan 2020

Hello ksertkaya,

Please find the code example in this post:
viewtopic.php?p=7611#p7611

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

21 Jan 2020

Thank you :)

Another question : How can I set max column width this column? I changed column's value but it seems like they have been overlaped. How can I set auto-fix?

Code: Select all

$('.RelatedItem a.ms-headerSortTitleLink')[index].text  =  item[0].Column1;
Screenshot_41.png
Screenshot_41.png (17.08 KiB) Viewed 3537 times

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

22 Jan 2020

ksertkaya,

You can set the width of the columns with the CSS.

For all columns please use this CSS:

Code: Select all

.ms-viewheadertr th {
   width: 350px;
}
And if you want to change the width of a specific column only, use this CSS:

Code: Select all

.ms-viewheadertr th:nth-child(5) {
   width: 350px;
}
Note that you should replace '5' with an index of the column that you want to format.

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

27 Jan 2020

Hi,

This code works! Thank you :)

Another question : When I clicked edit button, All columns' name returned internal name. How can I fix this issue?
Screenshot_45.png
Screenshot_45.png (24.3 KiB) Viewed 3487 times
Screenshot_46.png
Screenshot_46.png (21.72 KiB) Viewed 3487 times
Regards.

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

27 Jan 2020

Hello ksertkaya,

The CSS classes of the column headers are different for a standard and quick edit views.

To change the column header in a quick edit view, please use the following code.

Code: Select all

$('.ms-spGrid-HeaderContentStyle')[0].innerText = 'New Title';

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

28 Jan 2020

It works! Thanks a lot :)

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

30 Jan 2020

Hello,

Another question :) : We would like to make an addition operation on quick edit mode in related item. When the values of the columns (please see screenshot) are entered, the sum of them will be calculated and entered in another column.
Screenshot_47.png
Screenshot_47.png (125.98 KiB) Viewed 3467 times

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

30 Jan 2020

Dear Sertkaya,
Unfortunately, that's not possible, at least as far as I am aware. Maybe if you use Calculated column, then it could work.

The issue is that Related Items is just a regular SharePoint List view, there are no extra tools in our JS API for it. If there are solutions which work in Quick Edit mode in regular SharePoint lists, then they might work here as well.

P.S. Workflow might work, but you'll need to refresh Related Items manually, and it''s impossible to say when Workflow is ready.

You can use the following JS to refresh Related Items:

Code: Select all

fd.relatedItems(0).data('ctx').clvp.RefreshPagingEx('');
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 12 guests