Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/BootstrapBlazor/Components/Table/Table.razor.Toolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,11 @@ public async Task EditAsync()
else
{
await ToggleLoading(true);
EditModel = (IsTracking || DynamicContext != null) ? SelectedRows[0] : Utility.Clone(SelectedRows[0]);

// 复制对象给编辑模型
EditModel = (IsTracking || DynamicContext is not DataTableDynamicContext)
Comment thread
ArgoZhang marked this conversation as resolved.
Outdated
Comment thread
ArgoZhang marked this conversation as resolved.
Outdated
? SelectedRows[0]
: Utility.Clone(SelectedRows[0]);
Comment thread
ArgoZhang marked this conversation as resolved.
Outdated
if (OnEditAsync != null)
{
await OnEditAsync(EditModel);
Expand Down
3 changes: 3 additions & 0 deletions src/BootstrapBlazor/Dynamic/DataTableDynamicContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ private Task OnCellValueChanged(IDynamicObject item, ITableColumn column, object
// 更新内部 DataRow
if (_dataCache.TryGetValue(item.DynamicObjectPrimaryKey, out var cacheItem))
{
// 更新动态类型数据
Utility.SetPropertyValue<object, object?>(cacheItem, column.GetFieldName(), val);

// 更新原始 DataTable
if (cacheItem.Row != null)
Comment thread
ArgoZhang marked this conversation as resolved.
{
Expand Down
5 changes: 1 addition & 4 deletions src/BootstrapBlazor/Extensions/ObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ internal static void Clone<TModel>(this TModel source, TModel item)
{
if (item != null)
{
var type = typeof(TModel);

// <para lang="zh">20200608 tian_teng@outlook.com 支持字段和只读属性</para>
// <para lang="en">20200608 tian_teng@outlook.com Support fields and read-only properties</para>
var type = item.GetType();
Comment thread
ArgoZhang marked this conversation as resolved.
foreach (var f in type.GetFields())
{
var v = f.GetValue(item);
Expand Down
Loading