User Interface

The reusable component One.form.DocumentPanel has been provided which can be included in any ExtJS-based screen. This component takes the following parameters:

  • sysGoverningOrgId: sys id of the organization which should be used when looking up DocumentTypes

  • modelLevelType: model level to which the documents will be attached, used when looking up DocumenTypes

  • sysModelId: id of the model to which the documents are being attached

Here is an example where the DocumentType panel is added to the ModelForm JS class of a Book.

define([ 'One/DocumentPanel' ], function() {
Ext.ns('ZBKS');
ZBKS.BookDetail = Ext.extend(One.model.ModelFormContainer, {
modelInfo: {
modelLevelType: 'ZBKS.Book'
},
createActionName: 'ZBKS.CreateBook',
detailViewName: 'ZBKS.BookDetail',
actionConfig: {
listeners: {
load: function(formPanel) {
if (Ext.getCmp("docPanel") == undefined) {
var documentTypePanel = new One.DocumentPanel({
ModelLevelTypes: [ 'ZPTS.Book' ],
SysModelId: formPanel.sysId,
SysGoverningOrgId: UserProfile.context.OrgId,
fileHolderName: 'attachments',
id: 'docPanel'
});
formPanel.add(documentTypePanel);
formPanel.doLayout();
documentTypePanel.loadData(formPanel.model.Attachments);
}
},
beforemodelsubmit: function(formPanel, model) {
Ext.apply(model, {
Attachments: Ext.getCmp("docPanel").getData()
});
}
}
}
});
});