Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Updating feature with a POST request instead of a PUT request.
posted

Hello,

I am currently using a RESTDatasource to populate my igGrid and I d'like to know if there is a way to change the update behaviour to make a POST request instead of a PUT request. I am currently using a IIs WebServer and it can be difficult to use PUT requests when WebDav is installed (I can't be sure it won't be present). In the meantime, I'm still looking for a solution to make it work (WebDav + PUT Request) but if there is a POST solution it could be an acceptable fall back for me.

Thank you!

Parents
No Data
Reply
  • 5503
    Verified Answer
    Offline posted

    Hello Vincent,

    Thank you for using Infragistics forums!

    There is no direct way to set the HTTP verb for the update requests, however, you could inherit the RESTDataSource and change its verb mapping. It would look something like that:

    MyDataSource = $.ig.RESTDataSource.extend({
        _createLogVerbMapping: function () {
            this._logVerbMap = {
                "newrow": "POST",
                "row": "POST",
                "deleterow": "DELETE",
                "cell": "POST"
            };
        }
    });
    Then init a MyDataSource instance instead of a RESTDataSource one to pass to the grid (assuming you already do it like that instead of just setting the grid option restSettings). Have in mind that unless you override some additional functions, those update requests would now expect a created (201) response from the server to be considered successful. 
    I hope this helps! Please, let me know if you have further questions or concerns!
    Best regards,
    Stamen Stoychev
Children