
TablesExcelTitle
Commonly used for large data sheet maintenance
Get data collection through OnQueryAsync
callback
Demo
When using the List<TItem>
generic collection as a data source, you need to follow the steps below to set
Items
property of the Table
component or the OnQueryAsync
callback delegate methodprotected override void OnInitialized()
{
base.OnInitialized();
Items = Foo.GenerateFoo(Localizer);
}
OnAddAsync
callback delegate function to handle the New logicprivate Task<Foo> OnAddAsync()
{
// The code here is sample code
var foo = new Foo() { DateTime = DateTime.Now, Address = $"custom address {DateTime.Now.Second}" };
Items.Insert(0, foo);
// output log information
Trace.Log($"Collection value change notification column: {Items.Count} - Type: Add");
return Task.FromResult(foo);
}
OnDeleteAsync
callback delegate function to handle the delete logicprivate Task<bool> OnDeleteAsync(IEnumerable<Foo> items)
{
// The code here is sample code
Items.RemoveAll(i => items.Contains(i));
// output log information
Trace.Log($"Collection value change notification column: {Items.Count} - Type: Delete");
return Task.FromResult(true);
}
OnSaveAsync
callback delegate function to handle the cell update logicOnSaveAsync
callback delegate will be automatically triggered, and the parameter is the current update model TItem
private Task<bool> OnDeleteAsync(Foo item, ItemChangedType changedType)
{
// The code here is sample code
Trace.Log($"Cell Change Notification Class: Foo - value: cell");
return Task.FromResult(true);
}
Advanced usage
Demo
IsFixedHeader
fixed header height is set toHeight='500px'
Name
is not editable display avatar
B station related video link
交流群