Add post request body in Url Adaptor

Hi I am trying to use our rest api as data source of tree grid.But there is no clear documentation how to call a post request with request body in Data manager. Below is my approach. Please suggest a solution--

this.data = new DataManager({

      url: 'https://api.****.com/fetchtree',

      adaptor: new UrlAdaptor(),

      headers: [{ 'Authorization': 'Bearer +token }]

    });

    this.query = new Query()

      .addParams('userId', '1')

      .addParams('entityId', '2')

and in Template - 

<ejs-treegrid [dataSource]='data' [treeColumnIndex]='1' [query]='query' parentIdMapping='ParentItem' idMapping='TaskID' height=265 [allowPaging]="true">

    <e-columns>

        <e-column field='TaskID' headerText='Task ID' width='90' textAlign='Right'></e-column>

        <e-column field='TaskName' headerText='Task Name' width='170'></e-column>

        <e-column field='StartDate' headerText='Start Date' width='130' format="yMd" textAlign='Right'></e-column>

        <e-column field='Duration' headerText='Duration' width='80' textAlign='Right'></e-column>

    </e-columns>

            </ejs-treegrid>`


1 Reply

PK Padmavathy Kamalanathan Syncfusion Team June 23, 2021 01:27 PM UTC

Hi Dipesh, 
 
Greetings from Syncfusion Support. 
 
Query: how to call a post request with request body in Data manager 
 
You can pass additional parameters to server end with the help of addParams method. We have already discussed the same in the below Knowledge Base Help Documentation, 
 
Still facing issue in achieving your requirement, kindly share us the below details so that we can proceed further, 
  1. Complete Tree Grid rendering code (both client and server end
  2. Detailed explanation of your requirement with exact scenario
  3. Video demo of issue/requirement
  4. Screenshot of error with complete stack trace (if any)
  5. Also share us your product version details.
 
Regards, 
Padmavathy Kamalanathan          


Loader.
Up arrow icon