1

It seems quite simple to use HTTP POST method in igGrid using ajax post call by specifying requestType attribute. But, I am not able to find any method to specify the requestType in ASP.NET MVC wrapper for igGrid ( Infragistics 16.2 ).

@(Html.Infragistics()
        .Grid(Model)
        .ID("transactionGrid")
        .PrimaryKey("ID")
        .Height("550px")
        .Width("100%")
        .AutoGenerateColumns(false)
        .AutoGenerateLayouts(false)
        .Columns(column =>
        {
            column.For(x => x.ID).HeaderText("Broker");
            column.For(x => x.Category).HeaderText("Category");
            //column.For(x => x.BrokerName).HeaderText("Broker");
            column.For(x => x.ParAmount).HeaderText("Par").Format("N2");
            column.For(x => x.CommissionAmount).HeaderText("Commission").Format("N2");
        })
        .Features(features =>
        {
            features.Sorting().Type(OpType.Local);
            features.Filtering().Type(OpType.Local);
            features.Summaries()
                .Type(OpType.Local).CalculateRenderMode(SummaryCalculateRenderMode.OnSelect)
                .ColumnSettings(cs =>
                {
                    cs.ColumnSetting().ColumnKey("CommissionAmount").SummaryOperands(so =>
                    {
                        so.SummaryOperand().Type(SummaryFunction.Sum).Active(true);
                    });
                    cs.ColumnSetting().ColumnKey("ParAmount").SummaryOperands(so =>
                    {
                        so.SummaryOperand().Type(SummaryFunction.Sum).Active(true);
                    });
                    cs.ColumnSetting().ColumnKey("Category").AllowSummaries(false);
                    cs.ColumnSetting().ColumnKey("ID").AllowSummaries(false);
                });
        })
        .DataSourceUrl(Url.Action("GetTransactions"))
        .DataBind()
        .Render()
    )

2 Answers2

2

You can still set it through the grid prototype with:

$.ui.igGrid.prototype.requestType = "POST"

added somewhere before the grid initialization code.

The reason it is not exposed is that the automated remote operations such as Sorting/Filtering/Paging etc. only work with parameters encoded in the URL which assumes a GET request. If you handle the remote operations yourself, that is you are not decorating your controller methods with GridDataSourceActionAttribute, there is no reason you can't change the request type through the aforementioned prototype change and read and process the query from the request body.

Hope this helps!

  • but, the point is I want to set the request type in MVC igGrid wrapper not in javascript igGrid. The information I'm passing in to get the grid data is too big to be included in the URL. Therefore, I'll need that to be passed in the request's post body when the grid sends the request to the server for the grid data. Doing it with a separate AJAX call will also be a possible option but I'd like to see if this can be achieved by using the ig remote data source directly in MVC igGrid – Yousaf Khan Oct 18 '18 at 12:43
0

I found the answer: As the Grid ASP.NET MVC Wrappers main use case is to be used with the server-side handling of the remote grid features the "requestType" option is not exposed in the wrapper, because the server-side features handling (GridModel.GetData and GridDataSourceAction) is only working with HTTP GET method.

Exposing requestType in the MVC Wrapper is something that they are looking forward to implement in a future version of Ignite UI for JavaScript, but Ignite UI 16.2 is out of support, so it won't get into it.