With AjaxAutocomplete
possible, for example, when you edit the object name to get auto-completion for this field, which will offer the names of existing objects that begin with the entered characters. AjaxAutocomplete
use of jquery ui so jquery ui will need to be connected.
Also, it is possible to associate with autocompletion lukapa. Either enable auto-completion from Ajax lucapa.
Connection
If the file is not connected, you must perform the following:
- To update the version
ICSSoft.STORMNET.Web.AjaxControls.dll
- Add styles
jquery-ui.css
and a picture with the loadingindicator.gif
; - Add library
jquery ui
; - To update the version
ICSSoft.STORMNET.Web.Tools.dll
Use
You should make sure that the settings for ServiceSecurityProvider are correct. In order to specify the control to which to apply autotopagnosia, you add a method
AjaxAutocomplete.AddControlAutocomplete(контрол, тип_объектов, свойство_объекта)
for example, in Page_Load()
;
You can specify whether to use search for a substring and limiting.
//AjaxAutocomplete.AddControlAutocomplete(control, typoberlin, svoistvakh, использовать_ли_поиск_по_подстроке, limit);
AjaxAutocomplete.AddControlAutocomplete(ctrlЦена, typeof(Кошка), "The price", false, func2);
Example
AjaxAutocomplete.AddControlAutocomplete(ctrlКличка, typeof(Кошка), "Nickname");
AjaxAutocomplete.AddControlAutocomplete(ctrlЦена, typeof(Кошка), "The price");
Sorting and Distinct
If input is specified in the view, then all the fields will fall under Distinct. To apply sorting on any property in view.
Coloring matching characters in the dropdown list
All the javascript associated with the autocomplete file is AjaxDataService.js
.
Coloring characters were redefined renderItem
the prototype autocomplete.
$(function () {
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
var re = new RegExp(this.term, 'i');
var t = item.label.replace(re, "<span style='font-weight:bold;color:Blue;'>" +
this.term +
"</span>");
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + t + "</a>")
.appendTo(ul);
};
});