We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Grid Component - sending POST request

Hi, In my project I try to use Grid Component and binding WebApiAdaptor (I have end point service). Insert new recond is by built-in toolbar item (add). How I can send http POST request to the webapi using WebApiAdaptor and this built-in (adding new record)?



Here's a code snippet:


        new DataManager({

            url: urlCreateJson,

            adaptor: new WebApiAdaptor,

            headers: [{'Content-Type': 'application/xml'},

            { 'Access-Control-Allow-Origin': 'localhost:4200' }, 

            { 'Content-Type': 'application/json' },

            { 'Authorization': 'Bearer Vh7oqektMBNhHiKOdE4pLPKksgWvan0wE6WkCDfMx-VdDmP86cr1w' }],

            requestType: 'POST',

            crossDomain: true

        });

        this.dm.executeQuery(new Query())

        .then((e: ReturnOption) => this.items = <Object[]>e.result).catch((e) => true);


Thank you in advance for your help.




1 Reply

MS Madhu Sudhanan P Syncfusion Team November 14, 2018 12:00 PM UTC

Hi Grzegorz, 

Thanks for contacting Syncfusion support. 

From the code example we understood that you are performing data fetching externally using our DataManager. We suggest you to assign the DataManager directly to the dataSource property that handles all the grid actions and edit operations internally. Please go through the following links to use the assign dataSource as instance of DataManager. 



If the above link didn’t helped, please let us know we will provide sample based on your requirement. 

Regards, 
Madhu Sudhanan P 


Loader.
Live Chat Icon For mobile
Up arrow icon