Released: SharePoint LiveListData
Last week I published my fourth CodePlex project, called SharePoint LiveListData. It is an “assembly-free” solution which means that it contains no server side code. It is implemented as a jQuery plugin.
So what does it do? It uses AJAX to automatically reload any list-based Web Parts as soon as a change in the underlying list data is detected. You can also have your custom web parts refreshed, as long as they have a web part property that contains the ID of the list they depend on!
I have put online a screencast that demonstrates the the user experience.
Want to know how it works? Allow me to describe using some pseudo code..
- Make a single call to WebParts.asmx web service using AJAX to return an xml document with all web parts on the current page
- Parse returned xml and find all web part nodes that contain a ListID element (which holds the value for the ListID web part property)
- LOOP with interval = $configured_interval
- Make a single call to Lists.asmx web service using AJAX to retrieve “LastDeleted” and “Modified” properties for each ListID in the hashtable that was created earlier.
- For each ListID in hashtable
- compare values for LastDeleted and Modified with those values retrieved as part of the previous loop iteration for this ListID (unless it’s the first iteration).
- If any of the ListIDs are marked as UpdatePending
- Make an AJAX request to page that is currently loaded in the browser (allowing us to get a fresh copy of the current page containing the new list data)
- For each ListID marked as UpdatePending
- Replace div with matching WebPartID attribute in current document with “same” div in AJAX response (which contains the new list data).
This is basically how it works in a nutshell.
For examples on usage, check out the downloads tab on the SharePoint LiveListData CodePlex site, where you can also download the script!