我动态生成EXT.NET gridview,如下所示
public GridPanel GetGridView()
{
return new GridPanel
{
Border = false,
ID = "grd",
Cls = "x-grid-custom",
StyleSpec = "margin-top:7px; margin-left:-2px",
Scroll = ScrollMode.Both,
OverflowX = Overflow.Auto,
EnableColumnHide = false,
ColumnLines = true,
ForceFit = false,
//Width = 1100,
EmptyText = "No rows to display",
Store = { this.CreateTabularStore() },
ColumnModel =
{
Columns = {
new DateColumn {ID="ED", Text = "Effective Date",Wrap = true,DataIndex = "ED",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 110},
new Column {ID="PRICE", Text = "Price",DataIndex = "PRICE",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 70},
new Column {ID="CURRENCY", Text = "Currency",DataIndex = "CURRENCY",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 80},
new Column {ID="OFFICIAL",Text = "Official Price",DataIndex = "OFFICIAL",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
new DateColumn {ID="MARKETED_EFFECTIVE_DATE", Text = "Marketed Effective Date",DataIndex = "MARKETED_EFFECTIVE_DATE",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
new Column {ID="MARKETING_DESC", Text = "Marketed",DataIndex = "MARKETING_DESC",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 80},
new DateColumn {ID="DISCONTINUED_TS", Text = "Date Discontinued",DataIndex = "DISCONTINUED_TS",Format="dd MMM yyyy",Groupable = true, Html="<i class='prfl_unfilter_icon' onclick='return ShowGridFilter(this);'></i>" ,Width = 100},
}
},
Features = {
new Grouping(){HideGroupedHeader=false }
},
View = { new Ext.Net.GridView() { LoadMask = true, LoadingText = "Loading..." } }
};
}
下面是我如何在名为CreateTabularStore()
的方法中定义商店:
商店店; 模型模型;
store = new Store();
store.ID = "StorePD";
model = new Model();
model.Fields.AddRange(new ModelField[] {
new ModelField("ED",ModelFieldType.Date),
new ModelField("PRICE", ModelFieldType.Float),
new ModelField("CURRENCY"),
new ModelField("OFFICIAL"),
new ModelField("MARKETED_EFFECTIVE_DATE",ModelFieldType.Date),
new ModelField("MARKETING_STATUS_DESC"),
new ModelField("DISCONTINUED_TS",ModelFieldType.Date)
}
);
当我使用DateColumn
过滤器过滤网格时,网格列在 IE 8 浏览器中呈现失真,如下图所示