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
close icon

Need to use different key value while performing delete in Vue Grid

Hi,

I am trying to perform the delete function from the data grid. I have set one data column is the primary key.
Therefore, it return the URL is considered correct as shown in the screenshot. "http://localhost:5000/api/user/23"

However it still meets error line is because the request payload only returns a value with number without any key like a json object format?

I also tried to bind it with the params, this.query = new Query().addParams("id", 23), however it still cannot store it.

Is there any clue on set the request data in JSON format, exmaple: "id" : "23", and that will fix my issue.

Awaiting your soonest reply for help

Attachment: Dashboard_2d81e668.rar

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team November 12, 2019 01:57 PM UTC

Hi Chew, 

As per webApi standard, we have sent the Http POST, PUT, DELETE request to perform the CRUD actions in server side along with their primary key value. However if you wish to modify the request url data then you can achieve it by overriding the required CRUD operation methods in the custom adaptor and changing the request url as per your need. 

// Custom adaptor 
class SerialNoAdaptor extends WebApiAdaptor { 
            // Delete operation 
            remove(dm, keyField, value, tableName) { 
                return { 
                    type: 'DELETE', 
                    // Here you can modify the request url as per your requirement 
                    url: dm.dataSource.url + ‘/id:’ + value,   
                    data: JSON.stringify(value) 
                }; 
            }         
} 

Regards, 
Thavasianand S. 


Loader.
Up arrow icon