I woud like to have a expendableGrid in my BO like you have with the productionOption value display for a product.
But I can't figure out how to set the selected record into my second datasource for the expandable grid.
When it come to get value of the product option of my selected product ,all of the values which have the same product option type are returnes, and not only the ones who are linked to my product.
Below my setup function in my presenter
Code: Select all
//Vue product option par modalité d'accés
getPresenterSequenceSetupManager().addOrReplaceItem(new PresenterSetupItem("virtualProductOptionValuesDS", new VirtualProductPriceByOptionDataSourceFactory(), new NullAsyncCallbackAdapter()));
getPresenterSequenceSetupManager().addOrReplaceItem(new PresenterSetupItem("virtualProductOptionsDS", new VirtualProductOptionDataSourceFactory(), new AsyncCallbackAdapter() {
@Override
public void onSetupSuccess(DataSource result) {
virtualProductOptionsPresenter = new AssociatedProductOptionPresenterBasic(getDisplay().getVirtualProductPriceDisplay(),null, null);
virtualProductOptionsPresenter.setDataSource((ListGridDataSource) result, new String[]{"label", "type", "required", "maxAllowed"}, new Boolean[]{true, true, true,true});
virtualProductOptionsPresenter.setExpansionDataSource((ListGridDataSource) getPresenterSequenceSetupManager().getDataSource("virtualProductOptionValuesDS"), new String[]{"modalityAccess.name", "businessSalePrice", "consumerSalePrice"}, new Boolean[]{true, true, false});
}
}));
the data source I used for get the list of productOption the list
Code: Select all
public void createDataSource(String name, OperationTypes operationTypes, Object[] additionalItems, AsyncCallback<DataSource> cb) {
if (dataSource == null) {
operationTypes = new OperationTypes(OperationType.BASIC, OperationType.NONDESTRUCTIVEREMOVE, OperationType.BASIC, OperationType.BASIC, OperationType.BASIC);
PersistencePerspective persistencePerspective = new PersistencePerspective(operationTypes, new String[]{}, new ForeignKey[]{});
persistencePerspective.addPersistencePerspectiveItem(PersistencePerspectiveItemType.FOREIGNKEY, new ForeignKey("products", EntityImplementations.PRODUCT, null));
DataSourceModule[] modules = new DataSourceModule[]{
new BasicClientEntityModule(MFCeilingEntities.MFPRODUCT_OPTION, persistencePerspective, AppServices.DYNAMIC_ENTITY)
};
dataSource = new ListGridDataSource(name, persistencePerspective, AppServices.DYNAMIC_ENTITY, modules);
dataSource.buildFields(null, false, cb);
} else {
if (cb != null) {
cb.onSuccess(dataSource);
}
}
}
and to finish the data source I used to get the value of my productoption price
Code: Select all
public void createDataSource(String name, OperationTypes operationTypes, Object[] additionalItems, AsyncCallback<DataSource> cb) {
if (dataSource == null) {
operationTypes = new OperationTypes(OperationType.BASIC, OperationType.BASIC, OperationType.BASIC, OperationType.BASIC, OperationType.BASIC);
PersistencePerspective persistencePerspective = new PersistencePerspective(operationTypes, new String[]{}, new ForeignKey[]{});
persistencePerspective.addPersistencePerspectiveItem(PersistencePerspectiveItemType.FOREIGNKEY, new ForeignKey("product", EntityImplementations.PRODUCT, null));
persistencePerspective.addPersistencePerspectiveItem(PersistencePerspectiveItemType.FOREIGNKEY, new ForeignKey("modalityAccess", MFCeilingEntities.MODALITY_ACCESS, null));
persistencePerspective.addPersistencePerspectiveItem(PersistencePerspectiveItemType.FOREIGNKEY, new ForeignKey("productOption", MFCeilingEntities.MFPRODUCT_OPTION, null));
DataSourceModule[] modules = new DataSourceModule[]{
new BasicClientEntityModule(MFCeilingEntities.VIRTUALPRODUCT_PRICE_BY_OPTION, persistencePerspective, AppServices.DYNAMIC_ENTITY)
};
dataSource = new ListGridDataSource(name, persistencePerspective, AppServices.DYNAMIC_ENTITY, modules);
dataSource.buildFields(null, false, cb);
} else {
if (cb != null) {
cb.onSuccess(dataSource);
}
}
}
Do you have any idea how I can fix that ?
Hope you could help me to fix my problem

best regards
Renaud