0

How can I initialize Content Picker for ReferenceGrid field control to display content from current workspace only?

<sn:ContextInfo runat="server" Selector="CurrentWorkspace" UsePortletContext="true" ID="myContext" />
<sn:ReferenceGrid ID="ReferenceGrid1" runat="server" FieldName="RelatedDocuments" 
TreeRoots='<%# myContext.Path %>'/>

Thanks.

1 Answers1

1

There's a property on the Reference Field called SelectionRoot. You can add it and change its value in the CTD xml of your ContentType

Aniko Litvanyi
  • 2,109
  • 1
  • 21
  • 25
  • I want to set this dynamically in the content views, because there is no way to know the exact path value to set in the CTD xml. myContext.Path returns correct value, I just have not been able to apply it to TreeRoots property of the ReferenceGrid. – Djordje Marjanovic Nov 10 '17 at 09:22
  • Did you try the template parameters? http://wiki.sensenet.com/Content_Query_syntax#Template_parameters Maybe it can be used also it in the CTD xml – Aniko Litvanyi Nov 10 '17 at 09:24
  • Under ReferenceField (http://wiki.sensenet.com/ReferenceGrid_Field_Control): **TreeRoots**: the allowed path roots in Content Picker's tree are by default defined in the Reference Field configuration (SelectionRoot element) If I set in the following way: `` it works fine. If I set it as: `` It does not work. – Djordje Marjanovic Nov 10 '17 at 11:15