Skip to content

Instantly share code, notes, and snippets.

@shou1sannomiya
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shou1sannomiya/c9f51f00b4a6e536b2ff to your computer and use it in GitHub Desktop.
Save shou1sannomiya/c9f51f00b4a6e536b2ff to your computer and use it in GitHub Desktop.
ロードオンデマンドでの伝票一覧GridColumnLayoutModelのセット
...割愛...
//GridModelParam.Child には事前に子階層の生成に必要な情報をセットしている前提です。
GridColumnLayoutModel gridColumnLayoutModel = GetChildModel(GridModelParam.Child, "Child1");
//GridColumnLayoutModelを ColumnLayoutsに追加
ColumnLayouts.Add(gridColumnLayoutModel);
...割愛...
//---------------------------------------------------------------------------
//子階層のセット
public GridColumnLayoutModel GetChildModel(GridModelChildParam gm,string key)
{
GridColumnLayoutModel cm = new GridColumnLayoutModel();
cm.Key = key; //ここにセットした値はデータ取得時のlayoutにセットされます
cm.PrimaryKey = gm.PrimaryKey; //子階層のPrimaryKey
cm.ForeignKey = gm.ForeignKey; //親階層のPrimaryKeyとJoinする子階層のカラム名
cm.DataSourceUrl = gm.DataSourceUrl;//子階層のデータ取得URL
cm.Height = gm.Height;
cm.Width = gm.Width;
cm.AutoGenerateColumns = false;
cm.AutoGenerateLayouts = false;
cm.LoadOnDemand = true;
// Columns List<GridColumn>の転送
foreach (GridColumn para in gm.Columns)
{
GridColumn clm = new GridColumn();
clm.DataType = para.DataType;
clm.Format = para.Format;
clm.HeaderText = para.HeaderText;
clm.Hidden = para.Hidden;
clm.Key = para.Key;
clm.Template = para.Template;
clm.Width = para.Width;
cm.Columns.Add(clm);
}
//Features
foreach (var para in gm.Features)
{
cm.Features.Add(para);
}
return cm;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment