I am probably missing an obvious solution but after spending a couple of days on this topic I'm a bit stuck. The scenario I have is a site page with Content Editor Web Part (CEWP) and a Document Library Web Part (DLWP). My goal is to have custom filtering controls on the CEWP that trigger a AJAX call using a CAML query constructed by the current selection of the filter controls, and to display the results in either the DLWP, or something that has the same/similar look and feel as the DLWP.

I've gotten the CAML query working no problem, verified via console logging. Where I am stuck is figuring out how to visually display the results for users. Ideally I'd like to just filter the DLWP so the standard controls (version history, edit document, etc) are still there. I could generate some basic HTML to show the file name and location but this is not the objective.

Any help is appreciated.

EDIT: In case it adds clarity, the simplified use case is a response after the user types something to search for in the text input (ignores other controls). This is a condensed version of my callback function. The camlQuery is generated based on the search parameters.

function searchLibrary(asynchState, libraryName, camlQuery){
  //SOAP envelope constructed here

     async: asynchState,
     global: false,
     url: site+"/_vti_bin/lists.asmx",            
     type: "POST",            
     dataType: "xml",            
     data: soapEnvelope,            
     success: function(result){
         //What to do with the result here?     
     error : callError,            

I could use SPServices if it makes any difference. I'm fairly new to this, and it seemed that SPServices was mostly a wrapper library to make the above easier to create/maintain.


This blog post led me to the path to the answer: https://www.sharepointeurope.com/set-document-library-webpart-specific-folder-sharepoint-online/

In essence, I needed to use the ClientContext object to modify the view query and reload the view of the ListView Web Part (sorry for the non-standard naming above).

Once that is done, either the page needs to be reloaded or an async AJAX update to refresh the view with the query results. The AJAX can be configured with the webpart control, but I haven't found a way yet to trigger it once the new view is loaded.

Your Answer

