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
close icon

Refresh a single row programmatically

Hello, I currently have a grid and I'm trying to refresh a single row in that grid programmatically. I have the following edit settings:

public editSettings: EditSettingsModel = { allowEditing: true, allowEditOnDblClick: false };


And have tried this to refresh to refresh the row:

grid.editModule.updateRow(index, data);


But this approach is still refreshing the entire grid instead of just the single row. Should this work, or do I need something else? I am using version 20.3.50.


3 Replies

RR Rajapandi Ravi Syncfusion Team November 17, 2022 11:58 PM

Hi Andrew,


Greetings from Syncfusion support


When you update the edited data, the entire Grid will be refreshed automatically to reflect changes in its data source. Instead of refreshing the entire Grid during an update, you can use the following solution to refresh only the edited row by using actionComplete event of Grid. Please refer to the following code example and sample for more information.


 

public actionComplete(args: any) { //actionComplete event of Grid

      if(args.requestType == "save"){

        args.cancel = true;

        this.grid.isEdit = false;

        this.grid.currentViewData[args.rowIndex] = args.data;

        this.grid.editModule.editModule.refreshRow(args.data);

     }

    }

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/sample725926966.zip


API: https://ej2.syncfusion.com/angular/documentation/api/grid/#actioncomplete


Note:The above solution will work only for the inline mode of editing and local data in Grid.


Regards,

Rajapandi R



AT Andrew Tarr November 19, 2022 05:16 PM

Greetings Rajapandi,


I don't seem to have a "refreshRow" function: 

You mentioned that this will only for inline editing mode. Does that mean that a row cannot be updated programmatically?



RR Rajapandi Ravi Syncfusion Team November 21, 2022 09:07 AM

Andrew,


The above solution was working, when the row is in edit state and while saving the record the refreshRow() refresh the specific row. In your query you have mentioned that “row cannot be updated programmatically?”, so please confirm that you like to update the record without going to edited state or not.


Loader.
Live Chat Icon For mobile
Up arrow icon