I am working on a content search web-part inside my SharePoint Enterprise server 2013.
Now i have the following general overview of my current sites and lists which i am trying to query inside my web part:-
- Inside the Root site i have a list named
Dept
. SiteURL=http://servername/
- Inside another sub-site I have a list named
Module
which have a lookup field (DeptID
) referencing theDept
list. SiteURL=http://servername/Modules/
- Now for each
Module
item (inside the Module list) we have a sub-site representing this module item. the sub-site url will contain the module item ID, as follow;http://servername/Modules/1
(representing module item id 1),http://servername/Modules/2
(representing module item id 2), etc.. - Inside each
Module
sub-site we have a Tracking list.
Now i have added a Content Search WebPart inside my Dept
list's display form; to show all the Tracking items which are related to the current Dept Item (the dept item which is being rendered inside the display form).
So inside the content search web-part i am trying to do the following:-
- Now by default when users click on a certain
Dept
item, they will be redirected to the display form. and the department ID will be inside the URL such asDispForm.aspx?ID=16
.. - Using REST API i can query all the
Modules
items (inside the Module List) which have their DeptID (lookup column) = the current DeptID (for example 16 ). - So in this way i will have a list of all the module items' IDs which are related to the current Dept.
- Then i can inside my content search web part's display template (which will mainly show all the tracking items from all the module sub-sites) to specify to only show the Tracking items which are inside a sub-site and the sub-site's url = one of the related module IDs...
Now i am not sure how i can achieve these four steps inside my display templates?
Thanks
jQuery.$ajax( )
call, your own pure JavaScriptxhr
code , or learn to use the new PnPCoreJS library Microsoft developed and is about to hit version 2.0 : sharepoint.github.io/PnP-JS-Core