#102520
TurricanDE
Participant

Thanks for the example it works in my use case. Now the new added columns show the data. Great!

There is one issue left, could you investigate why this line is necessary:

 

grid.Columns = new List<GridColumn>() { }; //TODO: remove

 

Without this line, the columns never change. But we bind the columns property

<Grid DataSourceSettings=”DataSettings” @ref=”grid” DataSource=”dataRecords” Columns=”@columns”></Grid>

So this should actually trigger to set the new columns when the property changed?

I do not understand this (you commented it as removal, may this is a workaround)

grid.Columns = new List<GridColumn>() { }; //TODO: remove

It has side effects.

The columns are changed but you lost the symbols in the header (Sort, Filter etc.)

 

For example:

<Grid @ref=”grid” DataSource=”dataRecords” Columns=”@columns” Sorting=”@sorting”></Grid>

GridSorting sorting = new GridSorting { Enabled = true };

private void AddColumn()
{

GridColumn newColumn = new GridColumn(){ Label = columnsList[i], DataField = columnsList[i], SortOrder = GridColumnSortOrder.Desc };
columns.Add(newColumn);

grid.Columns = new List<GridColumn>() { }; //TODO: remove

}

The sort order symbols get lost here (also sort symbols on existing columns)

 

 

 

 

 

 

 

  • This reply was modified 2 years, 8 months ago by TurricanDE.