<SfGrid TValue="ExpandoObject" GridLines="GridLine.Horizontal" RowHeight="60" Width="auto" DataSource="@Transposed" AllowSelection="false" EnableHover="false">
<GridColumns>
@foreach (var col in Cols)
{
<GridColumn Field="@col">
<Template>
@{
dynamic data = (context as ExpandoObject);
<span>@(((IDictionary<String, Object>)data)[col])</span>
}
</Template>
</GridColumn>
}
</GridColumns>
</SfGrid>
|
|
<style>
.e-grid .e-gridheader .e-headercell .e-headercelldiv {
font-weight: normal;
}
</style>
|
<div style="width: 800px;height: 450px">
<SfGrid TValue="ExpandoObject" GridLines="GridLine.Both" RowHeight="60" Width="100%" Height="100%" DataSource="@Transposed" AllowSelection="false" EnableHover="false">
<GridColumns>
@foreach (var col in Cols)
{
<GridColumn Field="@col" Width=@(Cols.IndexOf(col) == 0 ? "50" : "100")>
<Template>
@{
dynamic data = (context as ExpandoObject);
<span>@(((IDictionary<String, Object>)data)[col])</span>
}
</Template>
</GridColumn>
}
</GridColumns>
</SfGrid>
</div>
<style>
.e-grid .e-gridheader {
display: none;
}
.e-grid .e-gridcontent {
border-top: 1px solid;
border-top-color: rgb(222, 226, 230);
}
</style>
@code{
DataTable dtFlat;
public void GenerateListFromTable(DataTable input)
{
Transposed = new List<ExpandoObject>();
System.Dynamic.ExpandoObject ECol = new System.Dynamic.ExpandoObject();
foreach (DataColumn col in input.Columns)
ECol.TryAdd(col.ColumnName, col.ColumnName);
Transposed.Add(ECol);
foreach (DataRow row in input.Rows)
{
System.Dynamic.ExpandoObject e = new System.Dynamic.ExpandoObject();
foreach (DataColumn col in input.Columns)
e.TryAdd(col.ColumnName, row.ItemArray[col.Ordinal]);
Transposed.Add(e);
}
} |
is it possible to do the same in a angular project?
We have branched a new thread for your last query. We close this thread now for any updates or further communication regarding that particular request, we kindly ask you to refer to the following thread -Inverting the rows and columns in EJ2 Angular grid - Branched from 161011 | Angular - EJ 2 Forums | Syncfusion