View style

rss

Posted by Андрей Тарутин - Oct 27 ’14 at 07:56

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?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #1 by Dmitry Kozlov Oct 28 ’14 at 03:55

    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.

  • Андрей Тарутин
    Андрей Тарутин
    Member
    Member for: 4 years 11 months 25 days
    #2 by Андрей Тарутин Oct 28 ’14 at 04:23

    I see, thank you.

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #3 by Dmitry Kozlov Oct 28 ’14 at 04:27

    [#2]: 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?

  • Андрей Тарутин
    Андрей Тарутин
    Member
    Member for: 4 years 11 months 25 days
    #4 by Андрей Тарутин Oct 28 ’14 at 04:40

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

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #5 by Dmitry Kozlov Oct 29 ’14 at 02:24

    [#4]: 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:

    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++;
    }
    
  • Андрей Тарутин
    Андрей Тарутин
    Member
    Member for: 4 years 11 months 25 days
    #6 by Андрей Тарутин Oct 29 ’14 at 03:20

    [#5]: Thank you for your reply.

Displaying 1 to 6 of 6 messages