Page 1 of 1

View style

Posted: 27 Oct 2014
by Андрей Тарутин
I've placed related items table on the form of parent item (sharepoint 2013). Now I want detail items in this table to be displayed with checkboxes (ability to select/unselect item clicking on checkbox). By default there is no ability to select items, is it possible?

Re: View style

Posted: 28 Oct 2014
by Dmitry Kozlov
Hi Andrew,

Generally speaking, yes. You can open the form in SharePoint Designer, find the appropriate WebPartPages:XsltListViewWebPart control and turn on the TabularView property of the View. But you will not see group actions on the ribbon that affect the selected items. Some of them don't work correctly in the context of another list, so we had to disable this functionality. I'd recommend to implement custom logic with help of additional buttons and plain JavaScript.

Re: View style

Posted: 28 Oct 2014
by Андрей Тарутин
I see, thank you.

Why it is impossible via forms designer's property View of the element "Related Items"?

Re: View style

Posted: 28 Oct 2014
by Dmitry Kozlov
Yes, we can add such functionality but currently it's quite useless, because it's impossible to apply group actions to the selected items. Could you briefly describe how you're going to use the checkboxes?

Re: View style

Posted: 28 Oct 2014
by Андрей Тарутин
Sure, I need a way user to be able to select items in order to apply some business logic for them. I don't need ribbon, but I can place custom button and write custom js, am I right? The only question is: how can I identify selected items in the related items element? The way I did it earlier doesn't work now: SP.ListOperation.Selection.getSelectedItems().

Re: View style

Posted: 29 Oct 2014
by Dmitry Kozlov
Hi Andrew,

All related items controls are stored in the following global variable: fd_relateditems_webparts. You can get the context of the specific one following way:

Code: Select all

var ctxNum = g_ViewIdToViewCounterMap['{' + fd_relateditems_webparts[0].toUpperCase() + '}'];
var ctxT = window["ctx" + ctxNum];
Next you can retrieve the selected items from the context:

GetSelectedItemsDict(ctxT);
and transform them into the dictionary:

var dictSelRet = []
for (var key in GetSelectedItemsDict(ctxT)) {
	dictSelRet[i] = {
		id: ctxT.dictSel[key].id,
		fsObjType: ctxT.dictSel[key].fsObjType
	};
	i++;
}

Re: View style

Posted: 29 Oct 2014
by Андрей Тарутин
Thank you for your reply.