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

How to render Grid with add form always in Angular Grid

I am using reactive form, and I have a custom add button to add grid record. 
I want to save the current row before adding new record. When I call endedit, and AddRecord, the new records do not work. No new records appear.


I need to add timeout like below to work. Do you have a better solution?


1 Reply 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team January 22, 2021 11:15 AM UTC

Hi lorryl, 

Greetings from syncfusion support 

We have analyzed your query and we could see that you are saving the current editable row by calling endEdit() method and also call the addRecord() method at the same time. While calling the two methods at the same time it will not function. You can achieve your requirement by using setTimeout function. Set some delay and call the addRecord() method to achieve your requirement. Please refer the below code example for more information. 
 
 
addtx(args) { 
      if(this.grid.isEdit) { 
        this.grid.endEdit(); 
      } 
      setTimeout(function(){  
      this.grid.addRecord(); 
         }.bind(this), 500); //Set some delay for calling the addRecord() method 
    } 
 

Regards,
Rajapandi R 


Marked as answer
Loader.
Up arrow icon