Is there a way to do an HTTP POST as the data source request type when binding data to the grid? The reason is that there will be cases in our application's usage in which the filters will be a very large collection of OR statements and this will be much too large to fit into a URL query string.
I was wanting something like the following:
var dataSource = new $.ig.RemoteDataSource({
dataSource: "/api/GetList"
type: "json",
requestType: "POST"
});
I have used Telerik's Kendo controls in the past and they seem to support this type of request, but using the Ignite UI controls, I receive an HTTP 405 (method not allowed) error. I still want to use the build in server-side paging/sorting/filtering features, but using HTTP POST so performing the call using AJAX would add too much complexity.
Hello Brian,
The Ignite UI controls (for example: igDataSource/igGrid/igHierarchicalGrid) support configuring the type of the request. They also support oData, so it should be possible to configure them to page, sort and filter if your data source is oData enabled.
Based on your information I cannot make any assumptions on what is causing the problem. Can you provide more information (or sample) about your grid configuration as well as your server endpoint.
P.S.: Your code is valid (except for the missing comma in the 2 line) and should work as expected.
Thank you in advance,
Martin PavlovInfragistics, Inc.
Martin,
I'm not doing anything fancy. My example is pretty simple.
var dataSource = new $.ig.RemoteDataSource({ dataSource: "/api/GetList", type: "json", requestType: "post" }); $("#DataGrid").igGrid({ dataSource: dataSource });
I left out some of the unimportant details. What I've observed from viewing the network activity is that the request is still being called with an HTTP GET but my API method is configured to only allow HTTP POST. This is why I was getting the HTTP 405 error.
I need help understanding why the call is being made with HTTP GET when I specify the verb as a POST.
The igGrid overrides some of the $.ig.DataSource options when it's set explicitly. In your case it overrides requestType option. That's why the grid makes a "GET" request. Moving your configuration directly into the grid will make it work.
Here is an example code:
$("#DataGrid").igGrid({ dataSource: "/api/GetList", type: "json", requestType: "post" });
P.S.: Is there a specific reason to explicitly instantiate $.ig.RemoteDataSource?
Hope this helps,Martin PavlovInfragistics, Inc.
Thanks Martin. This was the solution I needed. There wasn't a particular reason to separate the data source from the grid configuration. I was just trying to learn the proper way to use the controls and wasn't aware of this caveat.
Hi there!
I am implementing the same thing with remote paging feature. I errors out every time with message 'Javascript runtime error: Unable to get property 'count' of undefined or null reference.
Does http post with with remote Paging feature?
Thanks!