I get weird behaviour when deleting items with swipe action in DataGrid- need help solving delete behaviour

As the title says I get some weird behaviour when trying to delete items. My edit swipe action works as it should. However I can delete a few items from the DataGrid with swipe like say 5 out of 7. When I try to delete the last 2 items or the last item they end up not removing themselves from the grid. This also messes up the indexing if I then try to add another item or edit an item. 

Any idea what might be causing this issue? Is it possible it is a database problem?

Here is my git hub repo

https://github.com/SexyBeast007/datagrid

3 Replies 1 reply marked as answer

RS Renugadevi Sadagoban Syncfusion Team May 7, 2021 10:16 AM UTC

Hi Roberto,  
  
Thanks for contacting Syncfusion support.  
The eventList is not getting updated when you call box.delete method. Instead of that, you can use box.deleteAt(key) to remove a row from collection. Please refer the following code snippet for your reference,  
 
void deleteEvent(key) async { 
    var box = await Hive.openBox(_boxName); 
    await box.deleteAt(key); 
    eventList = box.values.toList(); 
    print('Deleted event at: ' + key.toString()); 
    refresh(); 
  } 
 
 
 
Please let us know for further assistance on this. 
  
 

Regards,

Renuga devi S



Marked as answer

RO Roberto May 8, 2021 02:06 AM UTC

Wow i cant believe I missed that!

Thank you so much. My DataGrid knowledge is now ready to be put into production :)


RS Renugadevi Sadagoban Syncfusion Team May 10, 2021 04:32 AM UTC

Hi Roberto, 
Thanks for your update. 
  
 
We are glad to know that issue is resolved at your end. Please let us know if you need any other assistance. 
 
Regards, 
Renuga devi S 


Loader.
Up arrow icon