Gentlemen,
is there a possibility to bind the TreeGrid columns to an array, please? I have the following structure:
public class ISDetails
{
public string strDate{ get; set; }
public decimal SumValue { get; set; }
public decimal PercValue { get; set; }
}
public class IncomeStmt
{
public string NewAccountNo { get; set; }
public string Parent { get; set; }
public decimal Total { get; set; }
public decimal TotalPerc { get; set; }
public ISDetails[] ISD { get; set; }
}
I can not use the AuoGeneration of the columns, because I don't want to show the Parent field. How can I diyplay this structure in the TreeGrid?
Thanks!
|
<SfTreeGrid ChildMapping="Children" @ref="treegrid" TreeColumnIndex="1" DataSource="@TreeData" TValue="BusinessObject" Columns="@Cols1">
</SfTreeGrid>
@code{
SfTreeGrid<BusinessObject> treegrid;
public List<TreeGridColumn> Cols = new List<TreeGridColumn>();
public List<TreeGridColumn> Cols1 = new List<TreeGridColumn>();
protected override void OnInitialized()
{
……
Cols.Add(new TreeGridColumn() { Field = "TaskId", HeaderText = "Task ID", Width = "80" });
Cols.Add(new TreeGridColumn() { Field = "TaskName", HeaderText = "Task Name", Width = "160" });
Cols.Add(new TreeGridColumn() { Field = "Duration", HeaderText = "Duration", Width = "80" });
Cols.Add(new TreeGridColumn() { Field = "Progress", HeaderText = "Progress", Width = "160" });
Cols1 = Cols.ToList();
}
}
|
Dear Pon,
thank you for your answer. It seems my question was not precise enough. I meant to bind the TreeGrid to the structure IncomeStmt in my example. As you can see it contains an array: ISDetails[], what causes me problem. I don't know how to bind the TreeGrid dynamically to this structure.
I mean I would need something like this:
<TreeGridColumn Field="ISD[5].SumValue" HeaderText="1" Width="100" ></TreeGridColumn>
or
Cols.Add(new TreeGridColumn() { Field = "ISD[3].SumValue", HeaderText = "ISD[3].SumValue", Width = "160"});
But clearly none of the above working.
Thanks:
Peter