[Razor] How to add StoreParameters to a GridPanel Store

  1. #1

    [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.

    @(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"));
    
                    })
    
    
    )
  2. #2
    Hi,

    Quote Originally Posted by jxlarrea View Post
    I don't see any Html.X().StoreParameter() builder
    There is the
    Html.X().StoreParameter()
    builder in the latest Ext.NET sources.

    So, it will work with the new release.

    For now you can create a StoreParameter using its constructor.

    Example
    .Store(store => store.Add(Html.X().Store()
        .AutoLoadParams(parameters =>
            parameters.Add(new StoreParameter() { Name = "test", Value = "test", Mode = ParameterMode.Value })
        )
    ))
    Quote Originally Posted by jxlarrea View Post
    I cannot find the PageSize property in Html.X().PagingToolbar().
    There is no such property. It should be set up for the Store as you already did.

Similar Threads

  1. [CLOSED] [RAZOR] Change the store on a GridPanel
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Jul 24, 2012, 12:12 PM
  2. [CLOSED] [2.0] Razor and Store LoadData
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 28, 2012, 6:45 PM
  3. [CLOSED] [Razor] Paging without Store Proxy
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 04, 2012, 2:52 AM
  4. [CLOSED] [Razor] Add GridView to GridPanel in razor
    By boris in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 09, 2012, 4:23 PM
  5. [CLOSED] How to access/reload store in razor views/controller
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 02, 2012, 1:38 PM

Tags for this Thread

Posting Permissions