View manager is used to create views, layouts, and fields based on optional
metadata inputs.
The view manager's factory methods (createView
, createLayout
, and
createField
) first check views
, layouts
, and fields
hashes
respectively for custom class declaration before falling back the base class.
Note the following is deprecated in favor of putting these controllers in the
sugarcrm/clients/<platform>
directory, or using one of the appropriate
factory methods like createView
, createField
, or createLayout
. Using
either of these idioms, your components will be internally namespaced by
platform for you. If you do choose to use the following idiom of defining
your controller directly on ViewManager.view.<type>
, please be forewarned
that you will lose any automatic namespacing benefits and possibly encounter
naming collisions if your controller names are not unique. If you must
define directly, you may choose to prefix your controller name by your
application or platform e.g. MyappMyCustom<Type>
where 'Myapp' is the
platform prefix.
Put declarations of your custom views, layouts, fields in the corresponding
hash (see note above; this is deprecated):
const ViewManager = require('./view-manager');
ViewManager.views.MyappMyCustomView = ViewManager.View.extend({
// Put your custom logic here
});
ViewManager.layouts.MyappMyCustomLayout = ViewManager.Layout.extend({
// Put your custom logic here
});
ViewManager.view.fields.MyappMyCustomField = ViewManager.Field.extend({
// Put your custom logic here
});