
Table Cell
Cell related operation example
Basic table display usage
Demo
In this example, by setting the OnCellRenderHandler
callback delegate, the cell merge operation is performed on the two columns Name
and Address
through the judgment condition, And set the background color of the merged cell by setting the TableCellArgs
attribute Class
value to cell-demo
style sheet name
.cell-demo {
--bs-table-bg: ##e9ecef;
}
Set the double-click event of the current cell by setting the OnDoubleClickColumn
callback
Demo
TableCellArgs
@page "/tables/cell"
@inject IStringLocalizer<TablesCell> CellLocalizer
<style>
.cell-demo {
--bs-table-bg: ##e9ecef;
}
</style>
<h3>@CellLocalizer["TablesCellTitle"]</h3>
<h4>@CellLocalizer["TablesCellDescription"]</h4>
<DemoBlock Title="@CellLocalizer["TableCellMergeCellTitle"]" Introduction="@CellLocalizer["TableCellMergeCellIntro"]" Name="MergeCell" Demo="typeof(Demos.Table.Cell.TableCellMergeCell)">
<p>@((MarkupString)CellLocalizer["TableCellMergeCellTip"].Value)</p>
<Pre>.cell-demo {
--bs-table-bg: ##e9ecef;
}</Pre>
</DemoBlock>
<DemoBlock Title="@CellLocalizer["TableCellOnDoubleClickCellTitle"]" Introduction="@CellLocalizer["TableCellOnDoubleClickCellIntro"]" Name="OnDoubleClickCell" Demo="typeof(Demos.Table.Cell.TableCellOnDoubleClickCell)">
<Tips>
<p>@((MarkupString)CellLocalizer["TableCellOnDoubleClickCellTip"].Value)</p>
</Tips>
</DemoBlock>
<AttributeTable Items="GetAttributes()" Title="TableCellArgs" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace BootstrapBlazor.Shared.Samples.Table;
/// <summary>
/// TablesCell
/// </summary>
public partial class TablesCell
{
private IEnumerable<AttributeItem> GetAttributes()
{
return new[]
{
new AttributeItem() {
Name = "Row",
Description = CellLocalizer["RowAttr"],
Type = "object",
ValueList = " — ",
DefaultValue = "<TModel>"
},
new AttributeItem() {
Name = "ColumnName",
Description = CellLocalizer["ColumnNameAttr"],
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "Colspan",
Description = CellLocalizer["ColspanAttr"],
Type = "int",
ValueList = " — ",
DefaultValue = "0"
},
new AttributeItem() {
Name = "Class",
Description = CellLocalizer["ClassAttr"],
Type = "string",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "Value",
Description = CellLocalizer["ValueAttr"],
Type = "string",
ValueList = " — ",
DefaultValue = " — "
}
};
}
}