Grid method delete with error

Hi,

   With the grid the operations get, post and put works Ok but I have a problem only with the method delete.

   

This is my dataManager

var remoteData: DataManager = new DataManager({

url: config.backendUrl + '/tenant/' + AuthCurrentTenant.get() + '/presupuesto-detalle-grid?presupuesto='+ match.params.id,

adaptor: new WebApiAdaptor,

headers: headerData,

});

My server nodejs responds :

 at IncomingMessage.onEnd (...\node_modules\raw-body\index.js:273:7)

at IncomingMessage.emit (events.js:327:22)

at IncomingMessage.EventEmitter.emit (domain.js:482:12)

at endReadableNT (_stream_readable.js:1221:12)

It seems that the method delete of the grid sends data in body that generates the error.

In that case how I can avoid this ?.

Thanks in advance.

Jorge





3 Replies 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team June 21, 2021 09:39 AM UTC

Hi Jorge, 

Greetings from Syncfusion support. 

By default for CRUD operations Grid will send the Row data with POST, PUT and DELETE for Insert, Update and Delete actions. For Delete action grid will send the Primary key value only to the server side as per the web API standard. Please refer the below screenshot for more information.  

For Delete: 

 

For Update:  

 

So we suggest you to handle the delete action according to the above format. If you still faced the issue, Could you please share the below details, which will be helpful for us to validate further about issue. 

  1. Share the server side code used for handling delete action
  2. Share the screenshot or video demo of the issue

Regards, 
Manivel 


Marked as answer

JV JORGE V June 27, 2021 04:24 PM UTC

Hi  Manivel,

   I modified my code in order to use the following adaptor modified :


class WebApiAdaptorCustom extends WebApiAdaptor {  
  remove(dmkeyFieldvaluetableName) {       
      return { 
          type: 'DELETE'
          url: dm.dataSource.url
          data: JSON.stringify({"id": value}) 
      }; 
  }    


 Now, It works !

Jorge



MS Manivel Sellamuthu Syncfusion Team June 28, 2021 07:24 AM UTC

Hi Jorge, 

Thanks for your update. 

We are glad that the requirement has been resolved. 

Please get back to us if you need further assistance. 

Regards, 
Manivel 


Loader.
Up arrow icon