Apr 09, 2012, 4:00 PM
[Razor] How to add StoreParameters to a GridPanel Store
Hello, in the following example when I attempt to Page it fails since the "shipcode" and "voy" parameters are not being sent to the AjaxProxy. I don't see any Html.X().StoreParameter() builder and if I tried to add a plain Html.X().Parameter() it throws a type error.
One more thing, I cannot find the PageSize property in Html.X().PagingToolbar().
Thanks for your help.
One more thing, I cannot find the PageSize property in Html.X().PagingToolbar().
Thanks for your help.
@(Html.X().GridPanel()
.Border(false)
.Store(store => store.Add(Html.X().Store()
.AutoLoad(true)
.PageSize(10)
.AutoLoadParams(parameters =>
{
parameters.Add(Html.X().Parameter().Name("shipcode").Value("AINU PRINCESS"));
parameters.Add(Html.X().Parameter().Name("voy").Value("12"));
parameters.Add(Html.X().Parameter().Name("start").Value("0"));
parameters.Add(Html.X().Parameter().Name("limit").Value("50"));
}
)
.Proxy(proxy => proxy.Add(Html.X().AjaxProxy()
.Url("/Data/GetCargo/")
.Reader(reader => reader.Add(Html.X().JsonReader()
.Root("result")
))
))
.Model(model => model.Add(Html.X().Model()
.Fields(fields =>
{
fields.Add(Html.X().ModelField().Name("Parcel"));
fields.Add(Html.X().ModelField().Name("BookingNo"));
fields.Add(Html.X().ModelField().Name("CommitStatus"));
fields.Add(Html.X().ModelField().Name("Charterer"));
fields.Add(Html.X().ModelField().Name("Commodity"));
fields.Add(Html.X().ModelField().Name("LoadPort"));
fields.Add(Html.X().ModelField().Name("DiscPort"));
fields.Add(Html.X().ModelField().Name("Qty"));
fields.Add(Html.X().ModelField().Name("Shipper"));
fields.Add(Html.X().ModelField().Name("CommDesc"));
})
))
))
.ColumnModel(columnModel =>
{
columnModel.Columns.Add(Html.X().Column()
.Text("Parcel")
.DataIndex("Parcel")
.Width(70));
columnModel.Columns.Add(Html.X().Column()
.Text("BookingNo")
.DataIndex("BookingNo")
.Width(70));
columnModel.Columns.Add(Html.X().Column()
.Text("CommitStatus")
.DataIndex("CommitStatus")
.Width(70));
columnModel.Columns.Add(Html.X().Column()
.Text("Charterer")
.DataIndex("Charterer")
.Width(70));
columnModel.Columns.Add(Html.X().Column()
.Text("Commodity")
.DataIndex("Commodity")
.Flex(1));
})
.BottomBar(bottomBar =>
{
bottomBar.Add(Html.X().PagingToolbar().DisplayMsg("Displaying {0} - {1} of {2}").EmptyMsg("No records to display"));
})
)