View style

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Андрей Тарутин
Posts: 13
Joined: Mon Aug 25, 2014

27 Oct 2014

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?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

28 Oct 2014

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.

User avatar
Андрей Тарутин
Posts: 13
Joined: Mon Aug 25, 2014

28 Oct 2014

I see, thank you.

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

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

28 Oct 2014

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?

User avatar
Андрей Тарутин
Posts: 13
Joined: Mon Aug 25, 2014

28 Oct 2014

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().

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

29 Oct 2014

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++;
}

User avatar
Андрей Тарутин
Posts: 13
Joined: Mon Aug 25, 2014

29 Oct 2014

Thank you for your reply.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests