Grid Repeating Rows

Hello! I’m having trouble understanding an Error in my Grid. I am uploading data tables to my application and I’m using a Grid to preview the data table coming in. I am using a class DataRow which holds the data rows information in a Map <String,Object> to hold <Column Name, Value>. However on display, the grid only shows a single data row repeating over the exact size of the table. I am trying to dynamically create a list of Grids with this code:

//convert each previewList into a grid and add to a list of grids
		for(List<DataRow> previewList : previewLists) {
			GridPro<DataRow> previewGrid = new GridPro<DataRow>();
			Binder<DataRow> binder = new  Binder<DataRow>();
			previewGrid.getEditor().setBinder(binder);
			
			previewGrid.setItems(previewList);
			
			if(previewList.size() == 0) {
				(new ConfirmDialog("Preview Data Failure", "There was an error previewing the data: No data was found. Please verify and try again.", "Close", e -> {})).open();
			}
			
			else {	
		
				for(String key: previewList.get(0).getValues().keySet()) {
					previewGrid.addColumn(datarow->datarow.getValue(key)).setHeader(key);
				}
			}
			
		
			previewGrid.setSizeFull();
			gridList.add(previewGrid);
		}

I have attached what the Grid looks like when it is rendered. I have gone through debugging it, and it shows that all the data rows, with their correct values are in the data provider so I am not sure where to go from here. Thank You!

18070545.png

I have one suggestion you could try. Add one property in your Map, which you could call e.g. id. Then create custom class extending ListDataProvider using your Map as type. You should override getId() method to return the id property. Ensure that id is unique for each Map.