SharePoint 2010 List View AJAX Options and Filter Web Parts - SharePoint Zen - ROXORITY ™ Sensational SharePoint Solutions
User Voices
(Loading...)
Our blog on SharePoint add-ons and solutions development
« PeopleZen Data Field Templates: one new feature, many new possibilities | Main | Sync User Profiles' Picture URL with Active Directory images (thumbnailPhoto / jpegPhoto) »
Sunday
Dec262010

SharePoint 2010 List View AJAX Options and Filter Web Parts

A FilterZen user reported the following issue:

I have tried to set up the Filter Web Part with an Issue List on SharePoint Server 2010 and everything seemed to work flawlessly except the List 'unfilters' every time it is auto-refreshed.

I have tried putting the filters in a Web Part on the List and applying it to a List in a Web Part where AJAX Options Asyncronous Refresh is enabled with the same result: the List unfilters every time it is auto-refreshed.

The strange thing is that it seems to work OK when AJAX Options Manual Refresh is applied to a List in a webpart?!

We could reproduce the issue, but now the much bigger question was how to fix this. First off, to summarize the issue:

  • In SharePoint 2010, List Views give you a tool-pane section with so-called AJAX Options:
    • the Show Manual Refresh Button option lets end users refresh the List data shown in the List View Web Part without reloading the entire page.
      • This AJAX refresh mode works just fine even with filters applied from connected Filter Web Parts such as FilterZen or the out-of-box Filter Web Parts.
    • the Enable Asynchronous Automatic Refresh option seemingly performs the above background data refresh periodically and automatically, without the end user having to click a button.
      • This AJAX refresh mode simply does not respect filters applied from connected Filter Web Parts, neither FilterZen nor the out-of-box Filter Web Parts!
  • Since the out-of-box Web Parts exhibit the same problem as FilterZen, this did not seem to be a bug in our product, but nevertheless wouldn't it be neat if this could be made to work, at least for FilterZen users?

We looked "long and hard" in SharePoint's unintelligible heap of client JavaScripts to figure out why the first AJAX background data refresh mode seemed to work but the second wouldn't, with respect to filters applied from connected Web Parts.

There may be an easy fix waiting to be discovered, but we couldn't figure it out. Rather than give up completely on the issue, we added the same "hack" to FilterZen that we figured we would also apply as SharePoint devs / consultants, would we face the issue in a real-world project:

  • the AJAX refresh called from the button works while the periodical background refresh doesn't (with respect to connection-provided filters)
  • hence:
    • deactivate the Enable Asynchronous Automatic Refresh option,
    • activate the Show Manual Refresh Button option and
    • add JavaScript to the page that periodically invokes the Manual Refresh button to "emulate" the automatic refresh, but in the way that has been shown to work (via the refresh button).
  • optionally also include script to hide the Manual Refresh button if this should not be made available to end users.

The above logic is now included directly in FilterZen so you won't need to script the above yourself, starting from and we tested this, it works! This affects all List Views on the page that have both Enable Asynchronous Automatic Refresh disabled and Show Manual Refresh Button enabled:

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

Author:  
Author Email (optional):
Author URL (optional):
Post:
|
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>