Core Docs

Button

Button generic — wire vào method C# qua `Events`, hoặc dùng `Name` đặc biệt để Core auto-bind.

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

Cấu hình

ComType:   Button
Name:      btnExport       # Name = btnSave/btnCancel/... → auto bind
Label:     Xuất Excel
Icon:      fas fa-file-excel
ClassName: btn btn-success
HotKey:    Ctrl+E
Events:    '{"click": "ExportExcel"}'

Field DB dùng

FieldVai trò
LabelText hiển thị trên button.
IconIcon class (FontAwesome fas fa-save) hoặc path file (icons/save.png).
ClassNameCSS class (Bootstrap btn btn-primary, btn-success, …).
StyleInline CSS style (width: 200px; margin-left: 8px).
EventsJSON map {"click": "MethodName"} để wire click → method C# trên class TabEditor.
FieldNameProperty bind (rare — dùng khi button thay đổi 1 field cụ thể).
QueryTham số query truyền vào method (rare).
IdDOM ID (rare — Core auto-generate).

Events kích hoạt

EventMethod signature
click(entity, this)

Tham số 2 là chính Button instance.

public class CustomerListBL : TabEditor
{
    public CustomerListBL() : base(nameof(Customer)) { }

    public async Task ExportExcel(object entity, object btn)
    {
        Spinner.AppendTo(Document.Body);
        try { /* export logic */ }
        finally { Spinner.Hide(); }
        Toast.Success("Đã xuất Excel");
    }
}

Name đặc biệt — Core auto-bind

Set Name = 1 trong các string sau, không cần Events:

NameHành vi mặc định
btnSaveGọi Save(Entity) của TabEditor/PopupEditor.
btnCancelĐóng tab/popup (prompt nếu dirty).
btnPrintIn report bound.
btnPreviewPrint preview.
btnSendSave + transition StatusId.
btnApproveApproval transition.
btnRejectRejection transition.

Tip

  • HotKey (vd Ctrl+S, F5, Esc) auto-wire phím tắt — không cần code thêm.
  • Icon dùng FontAwesome class hoặc path file (icons/save.png).
  • ClassName thêm class CSS Bootstrap (btn-success, btn-danger, …).

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