Checkbox
Boolean toggle — bind `bool` hoặc `bool?` của entity.
Source:
Core/Components/Checkbox.cs· ComType:Checkbox
Cấu hình
ComType: Checkbox
FieldName: Active
Label: Đang hoạt động
Field DB dùng
| Field | Vai trò |
|---|---|
FieldName | Property của entity (bool hoặc bool?). |
Editable | False → render disabled (không cho user click). |
Events | JSON map event → method C# (Change). |
(Checkbox không cần ShowLabel riêng — label nằm cùng checkbox theo style.)
Events kích hoạt
| Event | Method signature |
|---|---|
change | (entity, newValue, oldValue, parent) |
newValue / oldValue là bool.
public void OnActiveChanged(object entity, object newVal, object oldVal, object parent)
{
var c = (Customer)entity;
if ((bool)newVal == false)
{
Toast.Small("Khách hàng " + c.Name + " bị ngừng hoạt động");
}
}
Tip
- Bind sang
bool?(nullable) → check 3 trạng thái: true / false / null. Hiếm dùng. Editable = false→ render disabled.