0

Consider a situation where you need to display multiple list view web parts on the same page and retain most of the usual functionality like paging, sorting and filtering correctly. When you build your page, especially if you use web parts from different subsites in the site collection, you usually encounter an unexpected behavior: only the lowest web part works as expected.

What is the cause and how do we work around this issue?

0

The root cause for paging is the way the inplview.js script builds the URL to request the next portion of list item data for the view. Internally, it uses a function that analyzes the context of the web part, but it replaces the actual context of the clicked control with the context of the lowest web part.

Each list view web part has its own ctx1,ctx2,ctx3...ctx variable to store context, and if the unnumbered ctx is defined (and it always is), it overrides the needed numbered one.

What we need to succeed is place a junk list view web part that won't be used (you can later collapse or hide it) as the lowest on the page and replace its context with an undefined value in a script editor or a content editor web part with a script like this:

  <script language="javascript" type="text/javascript"> 
    document.addEventListener("DOMContentLoaded", function() {
      ctx = window["undefined"];  
    });
  </script>

That should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.