Oct 02, 2014, 2:42 PM
Gridpanel filter does not show
Hello
I have simple problem (or at least it appears to be simple). My Gridpanel FilterHeader is not shown when columns are created dynamically. Please see following sample:
Thanks
I have simple problem (or at least it appears to be simple). My Gridpanel FilterHeader is not shown when columns are created dynamically. Please see following sample:
@{
ViewBag.Title = "Filter";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
var X = Html.X();
}
@section example
{
@(
X.Viewport().ID("viewPort").Layout(LayoutType.Fit).Items
(
Html.X().GridPanel().Title("Filter example")
.Store
(
Html.X().Store()
.Model
(
Html.X().Model()
.Fields
(
new ModelField("company"),
new ModelField("price", ModelFieldType.Float),
new ModelField("change", ModelFieldType.Float),
new ModelField("pctChange", ModelFieldType.Float),
new ModelField("lastChange", ModelFieldType.Date)
)
)
)
.Plugins(Html.X().FilterHeader())
.ColumnModel
(
c =>
{
RowNumbererColumn c1 = new RowNumbererColumn();
c.Add(c1);
Column c2 = new Column();
c2.Text = "Company";
c2.DataIndex = "company";
c2.Flex = 1;
c.Add(c2);
Column c3 = new Column();
c3.Text = "Price";
c3.DataIndex = "price";
c3.Width = 75;
c3.Renderer.Format = RendererFormat.UsMoney;
c.Add(c3);
Column c4 = new Column();
c4.Text = "Change";
c4.DataIndex = "change";
c4.Width = 75;
c.Add(c4);
Column c5 = new Column();
c5.Text = "Change";
c5.DataIndex = "pctChange";
c5.Width = 75;
c.Add(c5);
DateColumn c6 = new DateColumn();
c6.Text = "Last Updated";
c6.DataIndex = "lastChange";
c6.Width = 85;
c6.Format = "H:mm:ss";
c.Add(c6);
}
//Html.X().RowNumbererColumn(),
//Html.X().Column().Text("Company").DataIndex("company").Flex(1),
//Html.X().Column().Text("Price").DataIndex("price").Width(75).Renderer(RendererFormat.UsMoney),
//Html.X().Column().Text("Change").DataIndex("change").Width(75),
//Html.X().Column().Text("Change").DataIndex("pctChange").Width(75),
//Html.X().DateColumn().Text("Last Updated").DataIndex("lastChange").Width(85).Format("H:mm:ss")
)
)
)
}
If you comment dynamic column creation (with delegate function) and uncomment fixed columns, filter suddenly appears. Since I need to create columns dynamically, what I have to do that filter will be shown?Thanks