I have an application with a dataGrid in v7 (translating from v6.10). I create a new entity and add it to the grid, then try to execute a editItem() call to navigate to the row I just created and open the editor. I get this:
llegalArgumentException: Entity must be non null
The code looks like this:
Updtrans updtrans = metadata.create(Updtrans.class);
updtransNestedDs.addItem(updtrans);
pinTable.editItem(updtrans);
updtransNestedDs is the datasource for the datagrid. The error occurs on the editItem() call.
<dataGrid id="pinTable" editorEnabled="true" height="350px" width="300px"
datasource="updtransNestedDs">
<actions>
<action id="create" invoke="onAddPin" shortcut="CTRL-ARROW_DOWN"/>
<action id="Save" invoke="onSavePin"/>
<action id="remove" invoke="onRemove"/>
</actions>
<columns>
<column id="mailfile" property="mailfile"/>
</columns>
</dataGrid>
When I step through the code at a low level, I get to this point in CollectionPropertyDatasourceImpl.java:
@Override
public T getItem(K id) {
backgroundWorker.checkUIAccess();
Collection<T> collection = getCollection();
if (collection != null) {
for (T t : collection) {
if (t.getId().equals(id)) {
return t;
}
}
}
return null;
}
This code returns null. But I can see that the ID is in the collection! Here is a screenshot:
As you can see (I hope), the ID fields ARE the same (4504).
Can anybody tell me what is going on here?