SPListViewFilter 1.5
I've published a new version of SharePoint list filter. Autocomplete is available in the new version:
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":
- function SetAutoComplete(listId, fieldId) {
- var baseUrl = "/_layouts/ListViewFilter/Handlers/FieldAutocompleteHandler.ashx";
- $("#AutoCompleteTextBox").autocomplete({
- source: baseUrl + "?List=" + listId + "&Field=" + fieldId,
- minLength: 2
- });
- });
Other parameters of autocomplete plugin may be viewed on www.jqueryui.com.