Links from related Items
Good Afternoon,
I have a display form with a number of related items views and for 2 of the views when a user clicks on any item in the view we need to open the item full screen either in the same window/tab or in a new window/tab rather than modal.
Is this possible?
Thanks
I have a display form with a number of related items views and for 2 of the views when a user clicks on any item in the view we need to open the item full screen either in the same window/tab or in a new window/tab rather than modal.
Is this possible?
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
In general, I recommend the following code:
But since you need it only for 2 of Related Items and not all, you can probably give a class (no-dialog, for example) to these Related Items and use it to be more specific:
In general, I recommend the following code:
Code: Select all
$('.ms-listlink').click(function(){
window.location.href = $(this).attr('href');
});
Code: Select all
$('.no-dialog .ms-listlink').click(function(){
window.location.href = $(this).attr('href');
});
Cheers
Hi Nikita,
I have tried both of those and nothing seems to have changed all items still open in Dialog.
As I said previously the form with the related items views on is a display form, unsure if that makes a difference?
I have also attached a couple of images showing how the related items are setup again unsure if that matters.
I am assuming I should simply paste the code within the JavaScript editor?
Also to give the related item a class again I am assuming I can do this by putting the no-dialog into the Css Class under Layout on the right hand toolbar within forms designer?
If the above is correct I can't see what else could be wrong?
Thanks
I have tried both of those and nothing seems to have changed all items still open in Dialog.
As I said previously the form with the related items views on is a display form, unsure if that makes a difference?
I have also attached a couple of images showing how the related items are setup again unsure if that matters.
I am assuming I should simply paste the code within the JavaScript editor?
Also to give the related item a class again I am assuming I can do this by putting the no-dialog into the Css Class under Layout on the right hand toolbar within forms designer?
If the above is correct I can't see what else could be wrong?
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
The reason the code didn't work is most likely that you are using Server render and the code is for Client render.
But since you use Server render, this should work, try it out:
The reason the code didn't work is most likely that you are using Server render and the code is for Client render.
But since you use Server render, this should work, try it out:
Code: Select all
$('.ms-vb a').click(function(){
window.location.href = $(this).attr('href');
});
Cheers
Hi Nikita,
Ok if I change my related items views to client render the original code you supplied works well, however the new code for server render does not appear to do anything.
The reason I have to use server render is that one of the related items views I have uses a view that is grouped and if I use client render all items are shown under each group i.e. 10 items in list, grouped by status 5 completed and 5 uncompleted, in server render 5 items are shown in each group. In client render all 10 items are shown under each group.
Any ideas on either how I can resolve the issue so I can change the related items to client render or why the code for server render doesn't work??
Thanks
Ok if I change my related items views to client render the original code you supplied works well, however the new code for server render does not appear to do anything.
The reason I have to use server render is that one of the related items views I have uses a view that is grouped and if I use client render all items are shown under each group i.e. 10 items in list, grouped by status 5 completed and 5 uncompleted, in server render 5 items are shown in each group. In client render all 10 items are shown under each group.
Any ideas on either how I can resolve the issue so I can change the related items to client render or why the code for server render doesn't work??
Thanks
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Tony,
That the code doesn't work with server render is strange as I've personally tested the code myself prior to posting it. Can you tell me which version of SharePoint you are using, so I can test it with it? I did my tests in SharePoint Online, it can be different for your version of SP.
Alternatively, it would be the best if you could save the page HTML where the form is. Open the form with Related items in server render mode, right click somewhere on the page, click Save as... And send me the file. That would ensure that I can check your own form and write the code that will work for you.
That the code doesn't work with server render is strange as I've personally tested the code myself prior to posting it. Can you tell me which version of SharePoint you are using, so I can test it with it? I did my tests in SharePoint Online, it can be different for your version of SP.
Alternatively, it would be the best if you could save the page HTML where the form is. Open the form with Related items in server render mode, right click somewhere on the page, click Save as... And send me the file. That would ensure that I can check your own form and write the code that will work for you.
Cheers
Hello Nikita, thanks for this solution.Nikita Kurguzov wrote: ↑14 Feb 2018Dear Tony,
In general, I recommend the following code:But since you need it only for 2 of Related Items and not all, you can probably give a class (no-dialog, for example) to these Related Items and use it to be more specific:Code: Select all
$('.ms-listlink').click(function(){ window.location.href = $(this).attr('href'); });
Code: Select all
$('.no-dialog .ms-listlink').click(function(){ window.location.href = $(this).attr('href'); });
That really meets my needs.
But, is there a chance to pass the source url (parent in display or edit form) on close/cancel of the child (in display form) to redirect to that previous source (parent)
Yet, on close user will be redirected to the child item list in standard view.
Thanks for your reply in advance!
Sincerely,
Christian
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear Christian,
Please, try the following:
Please, try the following:
Code: Select all
$('.ms-listlink').click(function(){
window.location.href = $(this).attr('href') + "&source=" + window.location.href.split("?")[0];
})
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 16 guests