Core Docs

MultipleSearchEntry

Multi-select picker — chọn nhiều entity, render dạng tag remove được.

Source: Core/Components/MultipleSearchEntry.cs ComponentType trong DB: Dropdown với Precision >= 2 (Core auto pick MultipleSearchEntry thay vì SearchEntry). Cũng dùng được MultipleSearchEntry qua reflection.

Cấu hình

ComType:    Dropdown          # alias; Precision >= 2 → MultipleSearchEntry
Precision:  2
FieldName:  TagIds
RefName:    Tag
DefaultVal: "[]"            # mặc định empty list

Field DB dùng

FieldVai trò
FieldNameProperty entity bind list FK (vd List<int> TagIds).
RefNameTên entity tham chiếu (vd "Tag").
LocalDataInline JSON list options → bypass API.
DefaultValGiá trị mặc định (vd "[]" cho empty list).
EventsJSON map event → method C# (Change).

Events kích hoạt

EventMethod signature
change(entity, listValues, oldList)

listValues / oldListList<object> — danh sách selection mới / cũ.

public void OnTagsChanged(object entity, object newList, object oldList)
{
    var tags = (newList as IEnumerable<object>)?.ToList();
    Toast.Small("Đã chọn " + (tags?.Count ?? 0) + " tag");
}

Behavior

  • Bind giá trị List<int> vào entity.<FieldName> (hoặc CSV tuỳ format).
  • Render selected items thành tag với nút “x” để remove.

Tip

  • Set DefaultVal: "[]" để khởi tạo empty list, tránh null.
  • Dùng cho many-to-many (Tag, Permission, …) hoặc tag-like collection.

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