mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-01 02:38:21 +08:00
PL-7497 IllegalStateException when trying to edit entity with the dynamic attribute
This commit is contained in:
parent
c90e366468
commit
b61a981a45
@ -687,7 +687,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
|
||||
}
|
||||
|
||||
if (e.getDs().getState() == Datasource.State.VALID && e.getDs().getItem() != null) {
|
||||
if (e.getDs().containsItem(e.getDs().getItem())) {
|
||||
if (e.getDs().containsItem(e.getDs().getItem().getId())) {
|
||||
newSelection.add((E) e.getDs().getItem());
|
||||
}
|
||||
}
|
||||
@ -1852,7 +1852,7 @@ public abstract class DesktopAbstractTable<C extends JXTable, E extends Entity>
|
||||
if (item != null) {
|
||||
setSelected(Collections.singleton(item));
|
||||
} else {
|
||||
setSelected(Collections.<E>emptySet());
|
||||
setSelected(Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,8 @@ public class EditorWindowDelegate extends WindowDelegate {
|
||||
if (!PersistenceHelper.isNew(item)
|
||||
&& !parentDs.getItemsToCreate().contains(item) && !parentDs.getItemsToUpdate().contains(item)
|
||||
&& parentDs instanceof CollectionDatasource
|
||||
&& ((CollectionDatasource) parentDs).containsItem(item)) {
|
||||
item = dataservice.reload(item, ds.getView(), ds.getMetaClass());
|
||||
&& ((CollectionDatasource) parentDs).containsItem(item.getId())) {
|
||||
item = dataservice.reload(item, ds.getView(), ds.getMetaClass(), ds.getLoadDynamicAttributes());
|
||||
if (parentDs instanceof CollectionPropertyDatasourceImpl) {
|
||||
((CollectionPropertyDatasourceImpl) parentDs).replaceItem(item);
|
||||
} else {
|
||||
|
@ -691,7 +691,12 @@ public class WebLookupField extends WebAbstractOptionsField<CubaComboBox> implem
|
||||
|
||||
protected void adoptMissingValue(Object value) {
|
||||
if (!ObjectUtils.equals(missingValue, value)) {
|
||||
if (optionsDatasource != null && !optionsDatasource.containsItem(value)) {
|
||||
Object itemId = null;
|
||||
if (value instanceof Entity) {
|
||||
itemId = ((Entity) value).getId();
|
||||
}
|
||||
|
||||
if (optionsDatasource != null && !optionsDatasource.containsItem(itemId)) {
|
||||
missingValue = value;
|
||||
} else if (optionsList != null && !optionsList.contains(value)) {
|
||||
missingValue = value;
|
||||
|
Loading…
Reference in New Issue
Block a user