Hi. I want to manage assets in a facility where there are multiple types of assets. Most assets are machines and there are inherited subtypes like gearbox, generator, machine, etc. This works so far.
When I display a list of assets, subtypes as gearboxes, generators, etc. are shown as expected. The problem is that when clicking on one of the entries, the window opens in the context of the generic asset, not in the context of the gearbox, generator, etc.
There is also the field type “collection name”, but for child collections it is not possible to set a default value.
Using JavaScript, it is possible to make the affected window (drawer, popup) open in the correct context, but this is cumbersome.
What would be helpful:
A dedicated field that sets the own collection name for inherited collections.
UI logic that evaluates this and opens the correct context on click.
What is your NocoBase version number? I’m not sure how your data table model is configured.
please provide a reproduction of the issue in the demo environment.
https://a_8hwne7u84ho.v13.demo.nocobase.com/admin/
(NocoBase default username and password)
In your demo site I have constructed a minimal example.
“generators” inherited from “machines”. When I click on ThisIsAMachine the corresponding Drawer opens. However, when I click on ThisIsAGenerator, also the same drawer opens.
It would be nice to have a mechanism which opens a drawer context based on the “real” collection name. Maybe, by a special field in the collection?
in the Action column:
add a View for each type of polymorphic collection, then changing the linkage rules on those view actions to only be visible if the Booking type (collection select) matches what the drawer/dialog/page is designed for.
A Details/Form view of the specific relation in the popup/drawer/page then has to have its data scope set to show the relevant record(s).
However, this solution is costly and not particularly elegant.
It would be a nice feature to have a build-in functionality so that a click on a polymorphic class opens the corresponding inherited class.