I am binding a datagrid to a non persisted entity that is programmatically populated based on user input. I get an error a refresh load() of DataLoader (see below)
@Inject
private DataGrid<JobSchedule_Stage> jobScheduleGrid;
@Inject
private CollectionLoader<JobSchedule_Stage> jobScheduleStageDl;
private ArrayList<JobSchedule_Stage> jobScheduleStageLst; //the non-persisted entity bound
@Install(to = "jobScheduleStageDl", target = Target.DATA_LOADER)
private List<JobSchedule_Stage> jobScheduleStageDlLoadDelegate(LoadContext<JobSchedule_Stage> loadContext) {
return jobScheduleStageLst;
}
@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
jobScheduleStageLst = new ArrayList<>(); //start datagrid as empty
jobScheduleStageDl.load();
}
Public void RefreshDatagrid() {
jobScheduleStageLst.clear();
. . . .load data into jobScheduleStageLst . . . .
jobScheduleStageDl.load(); //This errors with:
//DataContext already contains an instance with null id: com.jsonedi.jediadmin.entity.nonpersisted.JobSchedule_Stage-null [new]
}