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

Delete item in the toolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

142379 Jan 30,2019 10:55 AM UTC Feb 1,2019 10:49 AM UTC Angular - EJ 2 5
loading
Tags: Grid
Ane
Asked On January 30, 2019 12:49 PM UTC

Hello, 

Once the user has deleted ONE row, not multiple rows, automatically selects the next one. I don't want this to happend. How can I fix it? 

Looking forward to hearing from you, 

Ane

Pavithra Subramaniyam [Syncfusion]
Replied On January 31, 2019 12:31 PM UTC

 
Greetings from Syncfusion. 
 
Query: Once the user has deleted ONE row, not multiple rows, automatically selects the next one. I don't want this to happend 
 
We have analyzed your query and we can achieve your requirement by using the actionComplete and rowSelecting events for Nomal edit and for Batch edit we suggest to use the batchDelete event with clearRowSelection to clear the selected row after the delete operation. Please refer to the below sample and documentation for your reference, 
 
Code Example:  
 
[.ts]   [Normal edit] 
... 
complete(args) { 
        if(args.requestType == 'delete'){ 
          this.isDeleted = true; 
        } 
    } 
     
    selecting(args) { 
      if(this.isDeleted) { 
      args.cancel = true; 
      this.isDeleted = false; 
      } 
    }  
... 
 
 
                                https://ej2.syncfusion.com/documentation/api/grid/#rowselecting  
 
[.ts]  [Batch edit] 
... 
delete(args){ 
      this.grid.selectionModule.clearRowSelection(); 
    } 
... 
 
 
                                https://ej2.syncfusion.com/documentation/api/grid/selection/#clearrowselection  
 
Please get back to us for further assistance. 
 
Regards, 
Pavithra S. 


Ane
Replied On February 1, 2019 08:23 AM UTC

Hello, 

I have used Normal Edit but it's not working. 

(actionComplete)="onActionComplete($event)" (rowSelected)='onRowSelectionDelete($event)'

onActionComplete(event) {
if (event.requestType === 'delete') {
this.isDeleted = true;
}
}

onRowSelectionDelete(event: any) {
this.gridDelete.toolbarModule.enableItems(['grid_1625883774_0_delete'], true);
if (this.isDeleted) {
event.cancel = true;
this.isDeleted = false;
}
}

Looking forward to hearing from you, 

Ane

Pavithra Subramaniyam [Syncfusion]
Replied On February 1, 2019 09:25 AM UTC

Hi Ane, 

Thanks for your update. 

In your code you have used “rowSelected” instead of “rowSelecting” event which is the cause of the issue. Please refer to the below code example and sample link for more information. 

[component.html] 
<ejs-grid #normalgrid [dataSource]='data' [editSettings]='editSettings' [toolbar]='toolbar' (actionComplete)="onActionComplete($event)" (rowSelecting)='onRowSelectionDelete($event)'> 
            <e-columns> 
              .   .  
            </e-columns> 
        </ejs-grid> 
 

[component.ts] 
@Component({ 
    selector: 'control-content', 
    templateUrl: 'normal-edit.html', 

}) 
export class NormalEditComponent implements OnInit { 
     .    .  
    onActionComplete(event) { 
    if (event.requestType === 'delete') { 
      this.isDeleted = true; 
   
 

onRowSelectionDelete(event: any) { 
    if (this.isDeleted) { 
      event.cancel = true; 
      this.isDeleted = false; 
   
 
 


Please get back to us if you need any further assistance. 

Regards, 
Pavithra S. 


Ane
Replied On February 1, 2019 10:18 AM UTC

Thank you!


Pavithra Subramaniyam [Syncfusion]
Replied On February 1, 2019 10:49 AM UTC

Hi Ane,  

Thanks for your update.  

Please contact us if you need any further assistance. As always, we will be happy to assist you.  

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

;