How to refresh Grid after deleting item

In an attempt to delete a row I am performing the following:

complexGrid.getContainerDataSource().removeItem(itemId);

However after deletion the Grid does not refresh to reflect the deletion.
This technique appears to work in a Button renderer but not otherwise.

Any help would be appreciated.

What the container do you use?

Thanks for responding.

I am using Tomcat (Catalina).

I mean com.vaadin.data.Container implementation.
Also please open a browser console and ensure if there are no errors.

com.vaadin.data.util.BeanItemContainer
extending
com.vaadin.data.util.AbstractBeanContainer

If I find errors in my console I will post them, thanks!

Thank you for your help, I found an answer.

Rather than using:


Grid.getContainerDataSource().removeItem(itemId);

or

complexGrid.getContainerDataSource().removeAllItems();

I tried:


complexes = new ArrayList<>();
Grid.setContainerDataSource(new BeanItemContainer<>(ComplexModuleData.class, complexes));

The API related to removing Items did not return the appropriate results, but the API concerning setting the container data source to a null ArrayList did.

Thanks for your help and attention.

Hi,
Please any one help me out on below
when i delete a single row in grid formate the item was deleted, but need to immediate changes on grid without refresh page

    new_grid.addThemeVariants(GridVariant.LUMO_ROW_STRIPES);

	Column<AddQty> equipment = new_grid.addColumn(AddQty::getEquipName).setHeader("Equipments").setResizable(true);
	Column<AddQty> equipment_specification = new_grid.addColumn(AddQty::getTxttitle)
			          .setHeader("Equipment Specifications").setResizable(true);
	Column<AddQty> description_col = new_grid.addColumn(AddQty::getDescription).setHeader("Descriptions").setResizable(true);
	

new_grid.addColumn(new ComponentRenderer<>(item -> {			
		
		Button delete_Btn = new Button("");
	
		delete_Btn.setIcon(new Icon(VaadinIcon.ARROWS_CROSS));
		delete_Btn.addThemeVariants(ButtonVariant.LUMO_ERROR);
		delete_Btn.setWidth("100%");
		delete_Btn.addClickListener(ev -> {	 
		rep.deleteDescription(item.getTxttitle());			
		new_grid.getColumns();
		new_grid.setItems(add_modal);		
		update();
		
		});
		
		return delete_Btn;
		
	}));
	
	
	//Query on repo class
@Query(value = "delete from add_descriptions where txttitle = :title", nativeQuery = true)
public void deleteDescription(String title);

Any help would be Appreciate