autocomplete

javascript/css files

  1. awesomplete.css
  2. awesomplete.js
  3. mvcct.controls.js
  4. mvcct.controls.autocomplete.js

autocomplete shows a list of display name suggestions while the user types some letters in a text box. When the user selects a suggestion display name, the corresponding value is "selected". Chars typed by the user may be either the starting chars of each display name, or simply chars contained in the display name. The specific suggestion criteria are determined by the implementation of the action method that returns all suggesttions, given the chars typed by the user. That action method must return a Json array of objects, where each object contains both a display name, and a value.

See a live example

Tag helper properties

Tag name
autocomplete
asp-for: expression
the property containing the selected value
display-property: expression
the property containing the display value
ItemsUrl : string
the url where to retrive suggestions. This url must contain a string token that will be substituted by the string typed by the user before getting the url.
UrlToken : string
the token used by the previous url.
items-display-property : string
the name of the property containing the display name in the suggestions returned by the server.
items-value-property : string
the name of the property containing the value in the suggestions returned by the server.
min-chars : int
minimum number of chars to type before suggestions are shown.
max-results : int
maximum number of suggestions shown.
dataset-name : string
Results returned by the server are cached in the Html page. Name of the results-cache. Several controls selecting the same data should use the same name, to minimize memory usage and server round-trips.

Cache dimension and the way string are compared may be configure in the global mvcct-enhancer options object contained in wwwroot/startupjs/startup.js as detailed here.


Fork me on GitHub