Hi Devs,
I have an entity - mmxProduct - with a type field on it that can have one of two different types - Lite or Pro. I have two custom controllers which show a subset of the entity records depending on the type. The controllers look like this:
The where condition is Lite for one and Pro for the other and the two screens successfully show only their own subset of records.
I have corresponding clientDefs files for each of the controllers that point to the controller files eg
My problem is I want to show a different list layout for each of these screens - the pro version of the product has a field that is not present on the Lite version and I want to omit that field altogether from Lite list. Currently both screens use the list.json layout of the entity (the default behaviour).
I have tried doing this with a custom list view but it doesn't seem to have access to the layout. I've looked through the code to find ways to do it, but I can't find anything.
Does anyone know how I can do this?
Thanks,
Clare
I have an entity - mmxProduct - with a type field on it that can have one of two different types - Lite or Pro. I have two custom controllers which show a subset of the entity records depending on the type. The controllers look like this:
PHP Code:
define('custom:controllers/mmx-lite', ['controllers/record'], function (Dep) {
return Dep.extend({
entityType: 'MmxProduct',
getCollection(usePreviouslyFetched) {
console.log(`controller for Mmx product - mmx lite type`);
return Dep.prototype.getCollection.call(this)
.then(collection => {
console.log(`in then`);
collection.whereAdditional = [
{
field: 'productType',
type: 'equals',
value: 'Lite', // <-- this is set to 'Pro' on the other controller
}
];
return collection;
});
}
});
});
I have corresponding clientDefs files for each of the controllers that point to the controller files eg
Code:
{ "controller": "custom:controllers/mmx-lite", "boolFilterList": [ "onlyMy" ], ....
I have tried doing this with a custom list view but it doesn't seem to have access to the layout. I've looked through the code to find ways to do it, but I can't find anything.
Does anyone know how I can do this?
Thanks,
Clare