Skip to content

Commit

Permalink
DataGrid will no longer auto-generate column UniqueID and will save s…
Browse files Browse the repository at this point in the history
…ettings for columns only if Property or UniqueID is set
  • Loading branch information
enchev committed Aug 10, 2023
1 parent bce5ae8 commit 1a595c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Radzen.Blazor/RadzenDataGrid.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ internal void SaveSettings()
{
settings = new DataGridSettings()
{
Columns = ColumnsCollection.ToList().Select(c => new DataGridColumnSettings()
Columns = ColumnsCollection.ToList().Where(c => !string.IsNullOrEmpty(c.Property) || !string.IsNullOrEmpty(c.UniqueID)).Select(c => new DataGridColumnSettings()
{
UniqueID = c.UniqueID,
Property = c.Property,
Expand Down
3 changes: 1 addition & 2 deletions Radzen.Blazor/RadzenDataGridColumn.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,14 @@ internal int GetRowSpan(bool isDataCell = false)
/// Gets or sets the unique identifier.
/// </summary>
/// <value>The unique identifier.</value>
[Parameter]
public string UniqueID { get; set; }

/// <summary>
/// Called when initialized.
/// </summary>
protected override void OnInitialized()
{
UniqueID = $"Column{Grid.ColumnsCollection.IndexOf(this)}";

if (Grid != null)
{
Grid.AddColumn(this);
Expand Down

0 comments on commit 1a595c5

Please sign in to comment.