SPListViewFilter 1.5

I've published a new version of SharePoint list filter. Autocomplete is available in the new version:

SPListViewFilter 1.5 AutoComplete

jQuery and jQuery libraries with styles are requried by autocomplete functionality. I didn't add reference to them into SPListViewFilter' code because of this: 99% of the time it already is on a page. In addition it leaves the choise of version to end users.

AutoComplete on custom forms

Autocomplete uses handler located in the LAYOUTS folder and available by URL like this: http://SharePointSite/_layouts/SPListViewFilter/Handlers/FieldAutocompleteHandler.ashx. This handler takes three parameters: ListId, FieldId and Term (text for filtering).

Here is a simple JavaScript function, which binds autocomplete to the TextBox with id "AutoCompleteTextBox":

  1. function SetAutoComplete(listId, fieldId) {
  2.   var baseUrl = "/_layouts/ListViewFilter/Handlers/FieldAutocompleteHandler.ashx";
  3.   $("#AutoCompleteTextBox").autocomplete({
  4.     source: baseUrl + "?List=" + listId + "&Field=" + fieldId,
  5.     minLength: 2
  6.   });
  7. });

Other parameters of autocomplete plugin may be viewed on www.jqueryui.com.