Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add element template to custom bower bpmn js project ? #429

Closed
Syedgit opened this issue Oct 18, 2016 · 8 comments
Closed

How to add element template to custom bower bpmn js project ? #429

Syedgit opened this issue Oct 18, 2016 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@Syedgit
Copy link

Syedgit commented Oct 18, 2016

we are trying to add element template into below custom bower project using code from here https://forum.bpmn.io/t/element-templates-usage-in-property-panel/809/3 we could not achieve element template with this documentation. If we can get some detail help on this issue it would be great ?

index.js

`var BpmnViewer = require('bpmn-js/lib/Modeler');
var camundaModdleDescriptor = require('camunda-bpmn-moddle/resources/camunda');
var additionalModules = [
  require('bpmn-js-properties-panel'),

  // 1. require camunda provider instead of the bpmn one (!)
  require('bpmn-js-properties-panel/lib/provider/camunda')
];
BpmnViewer.prototype._modules = BpmnViewer.prototype._modules.concat(additionalModules);
// 2. include camunda moddle descriptor
BpmnViewer.prototype._moddleExtensions = { camunda: camundaModdleDescriptor }
module.exports = BpmnViewer;`
@nikku
Copy link
Member

nikku commented Oct 19, 2016

You cannot use element templates with the BpmnViewer (it is a diagram viewer). Use the BpmnModeler instead.

If you got more questions, please open a respective topic in the bpmn.io forum.

@nikku nikku closed this as completed Oct 19, 2016
@nikku nikku added the help wanted Extra attention is needed label Oct 19, 2016
@Syedgit
Copy link
Author

Syedgit commented Oct 19, 2016

so what changes i have to make to incorporate BpmnModeler ?

@nikku
Copy link
Member

nikku commented Oct 19, 2016

Just saw you were actually using the Modeler in the example code you provided.

How do you bootstrap the modeler in your application?

@nikku nikku reopened this Oct 19, 2016
@Syedgit
Copy link
Author

Syedgit commented Oct 19, 2016

we have modeler/ properties panel as a bower component which we attach to index.html file in an angular project.Here how we initiate modeler from angular controller.

modeler.controller.js 

var BpmnViewer = window.BpmnJS;

    var bpmnModeler = new BpmnViewer({
      container: '#canvas',
      propertiesPanel:{
        parent: '#js-properties-panel'
      }
    });

@nikku
Copy link
Member

nikku commented Oct 19, 2016

var bpmnJS = new BpmnJS({
  container: $el,
  additionalModules: [
    propertiesPanelModule,
    propertiesProviderModule
  ],
  elementTemplates: elementTemplates
  ...
});

You need to provide the template descriptors as an [] during modeler instantiation.

We will add a more detailed example show-casing this via bpmn-io/bpmn-js-example#32.

@nikku nikku closed this as completed Oct 19, 2016
@Syedgit
Copy link
Author

Syedgit commented Oct 19, 2016

So this is piece of code should be added to bower-viewer-custom.js or replacing with angular controller , How we are refering container: $el,?

@zengyanyu
Copy link

leave a comment

@preetvyas
Copy link

i follow this process
this.modeler = new Modeler({
container: '#canvas',
width: '100%',
height: '600px',
propertiesPanel: {
parent: '#properties'
},
additionalModules: [
propertiesPanelModule,
propertiesProviderModule,
ReplaceMenuProvider,
customTranslateModule
],
elementTemplates:botdetails.botdetails,
moddleExtensions: {
camunda: camunda.camunda
}
});
and i am able to set element templates but after set element templates when we click on task and based on that task need filter accordingly so element templates will display
anybody tell me how can i acheive this thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants