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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set the keyField for CRUD Operations

Thread ID:





143665 Mar 30,2019 06:07 PM UTC Apr 1,2019 02:21 PM UTC Vue 2
Tags: Data Grid
Asked On March 30, 2019 06:07 PM UTC

I use the WebApiAdaptor for remote data source. I also want to use the CommandColumn Option to delete the entries.
The issue now is, that the keyField is undefined in the remove function. So I receive urls like `http://example.com/user/undefined` . How do I set the correct key? In my case the key has the name hash and is not displayed in the grid, but is available in the source. I tried to define the key element in the Datamanager section, but I guess it's the wrong part.
<ejs-grid ref='grid' :data-source="gridSource" :allow-paging="true"
<e-column type='checkbox' width='50'>e-column>
<e-column field='firstname' header-text='Filename' width=90 :template="userTemplate">e-column>
<e-column field='account_created' header-text='Created at' width=90>e-column>
<e-column headerText='Manage Records' width='160' :commands='commands'>e-column>

data() {
return {

gridSource: new DataManager({
url: '/user',
adaptor: new WebApiAdaptor({

key: 'hash'
commands: [
{ type: 'Delete', buttonOption: { iconCss: 'e-icons e-delete', cssClass: 'e-flat' } },

Thanks in advance

Thavasianand Sankaranarayanan [Syncfusion]
Replied On April 1, 2019 07:23 AM UTC

Hi Christopher, 

Greetings from Syncfusion support. 

We have checked your query and we suspect that you did not provide primaryKey to the Grid. PrimaryKey is important when you perform deletion in Grid. So, please enable the primaryKey column by set isPrimaryKey property as true.  

Note: PrimaryKey column must be have the unique values.  

Refer the help documentation. 
If it’s not satisfy your requirement, Could please provide below details that will be helpful for us to provide better solution as early as possible. 

  1. Please share your Grid code.
  2. Share the screenshot of developer tool console to check script error if any.

Thavasianand S. 

Replied On April 1, 2019 02:21 PM UTC

Hello Thavasianand,

thanks for the hint. solved my issue.

Another question. Is it possible to hook in to the deletion process and show a toast with a message from the server if the deletion process was successfull or not?



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