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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How To Change the request URL when performing Insert, Update and Delete in the data grid toolbar button?

Thread ID:

Created:

Updated:

Platform:

Replies:

148937 Nov 8,2019 07:41 AM UTC Nov 12,2019 12:01 PM UTC Vue 1
loading
Tags: Data Grid
Chew Ann Kenn
Asked On November 8, 2019 07:41 AM UTC

Hi,

I have been tried to insert records from the data grid by using the Editing function with the WebApiAdaptor method. I noticed that the request URL pointing to the server-end is having a default format. 

For an example: 
1. When Insert, the URL will be like http://localhost:4000/api/users (POST)
2. When Update, the URL will be like http://localhost:4000/api/users (PUT)
3. When Delete, the URL will be like http://localhost:4000/api/users//undefined (DELETE)

Is that possible I can define my own API URL? I have tried to append the insertUrl: "http://localhost:4000/api/add-user"; updateUrl: http://localhost:4000/api/update-user; but it seems not working with it.

Besides, I also noticed that when performing inserting, we can define a default value on the column by using the params, but how can I bind the params to a drop down list for the particular column with multiple choice?

Hope you can assist me as soon as possible.

Attachment: Dashboard_1744ca2f.rar

Pavithra Subramaniyam [Syncfusion]
Replied On November 12, 2019 12:01 PM UTC

Hi Chew, 
 
Thanks for contacting Syncfusion support. 
 
As per webApi standard, we have send Http POST, PUT, DELETE request to perform the CRUD actions in server side and we don’t have support to define CRUD URL in webApiAdaptor. However, you can achieve your requirement by customizing the default WebApiAdaptor. 
 
  class SerialNoAdaptor extends ej.data.WebApiAdaptor { 
            insert(dm, data, tableName) { 
                return { 
                    type: 'POST', 
                    url: dm.dataSource.url, 
                    data: JSON.stringify(data) 
                }; 
            } 
 
            remove(dm, keyField, value, tableName) { 
                return { 
                    type: 'DELETE', 
                    url: dm.dataSource.url + '/' + value, 
                    data: JSON.stringify(value) 
                }; 
            } 
            update(dm, keyField, value, tableName) { 
                return { 
                    type: 'PUT', 
                    url: "Home/update",  // you can define the update url here 
                    data: JSON.stringify(value) 
                }; 
            } 
        } 
 
 
Query:  how can I bind the params to a drop down list for the particular column with multiple choice? 
 
While using dropdownedit then we have an option to send params to corresponding column dropdown list. Please refer the below documentation for more information. 
 
 
If you want to customize the dropdown list then you can use edit template feature to achieve your requirement. If the provided suggestion does not meet your requirement then share more details about your query that will helpful for us to validate further at our end. 
 
Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon