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

Not able to delete a row or a record from javascript

Thread ID:

Created:

Updated:

Platform:

Replies:

146182 Jul 24,2019 11:04 AM UTC Jul 25,2019 09:39 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: DataGrid
John Stephen Mangam
Asked On July 24, 2019 11:04 AM UTC

Hi,

Here is my grid:

<ejs-grid id="aaGrid" allowPaging="true" allowSorting="true" queryCellInfo="CommonGridCellTemplate">
    <e-grid-columns>
        <e-grid-column field="Id" isIdentity="true" isPrimaryKey="true" allowSorting="false" allowFiltering="false" visible="false"></e-grid-column>
...
    </e-grid-columns>
</ejs-grid>

Script code:
 var grid = document.getElementById("aaGrid").ej2_instances[0];
                grid.deleteRecord("Id", grid.getSelectedRecords()[0]);

ERROR when script gets executed: 
TypeError: Cannot read property 'deleteRecord' of undefined  at t.deleteRecord

Thavasianand Sankaranarayanan [Syncfusion]
Replied On July 25, 2019 09:39 AM UTC

Hi John, 
 
Greetings from Syncfusion support. 
 
Query : Script error throws 
 
We have checked your query and in you may missed to include the editSettings model which is essential to perform add/edit/delete actions. So, we suggest you to include the editSettings model in Grid rendering code and you can delete the records in grid.  
 
Please refer the below example code. 
 
[Index.cshtml] 
 
        <ejs-grid id="field-add-synonyms-list" dataSource=@ViewBag.dataSource allowfiltering="true" allowselection="true" rowselected="rowselected"> 
            <e-grid-filtersettings type="Menu"></e-grid-filtersettings> 
            <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings> 
             
            <e-grid-columns> 
                . . . .  
            </e-grid-columns> 
        </ejs-grid> 
   
 
 
 
Refer the help documentation 
 
 
Regards, 
Thavasianand 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