Core Docs

AutocompleteTextbox

Textbox + autocomplete suggestion — gợi ý realtime khi user gõ.

Source: Core/Components/AutocompleteTextbox.cs · ComType: AutocompleteTextbox

Cấu hình

ComType:           AutocompleteTextbox
FieldName:         Address
Reference:         Address                       # entity gợi ý
DataSourceFilter:  ?$filter=Active eq true       # bắt buộc đủ "?$filter="
Template:          "{Street}, {City}"           # format hiển thị item

Field DB dùng

FieldVai trò
FieldNameProperty entity bind value text (string).
ReferenceType entity nguồn suggestion.
RefNameTên entity nguồn dạng string.
DataSourceFilterOData filter đủ ?$filter=... cho list suggestion.
QueryCustom SQL/OData query.
TemplateString format hiển thị mỗi suggestion ("{Code} - {Name}").
FormatDataFormat hiển thị value sau khi chọn.
FormatEntityFormat toàn bộ entity đã chọn.
GroupFormatFormat header group trong dropdown nếu IsPivot=true.
GroupReferenceNameTên field group trong reference.
IsPivotTrue → group suggestion theo field.
ShowLabelTrue → render <label> cạnh widget.
UpperCaseTrue → uppercase value khi blur.
PlainTextTrue → bỏ URL-encode 6 ký tự đặc biệt (+ / ? # & '), lưu raw.
AutoFitTrue → input co giãn theo nội dung.
ChildStyleInline CSS style trên <input> element.
EventsJSON map event → method C# (Change, Input, KeyDown, Click, FocusIn, …).

Events kích hoạt

EventMethod signature
change(entity, matched)
input(entity, matched)
focusin(entity, matched)
focusout(entity, matched)
keydown(entity, matched)
click(entity, matched)
scroll(entity, matched)

matched là item gợi ý đang highlight (có thể null khi user gõ tự do).

Khi nào dùng

  • Field tự do nhưng có gợi ý (địa chỉ, số điện thoại đã có sẵn, mã sản phẩm, …).
  • Không bắt buộc user chọn từ list — họ vẫn gõ tay được.

Tip

  • Template là string format có placeholder {FieldName}.
  • Dùng AutocompleteTextarea cho nhiều dòng.

Core Docs · Astro · Core.API/wwwRoot/docs