DMN modeler: Edit dmn with JavaScript

Hi there,
I hope i can find some help here :slight_smile:

I build my new project with this https://github.com/bpmn-io/dmn-js-examples/tree/master/modeler example project.
Now I want to add new rules (rows) or whatever, columns, input data nodes,…
Can someone provide me a link to some documentation?
Or can I use the “dmnModeler” object from the example to perform such actions?
I can not use nodejs for my project and sorry for my beginner questions.

Thank you for your time and help :slight_smile:

Currently i am adding new rules with something like this:

$('#tab-dec-' + decisionId).click();
  $('.tjs-table tfoot .add-rule-add').click();
  let $lastRow = $('.tjs-table tbody tr:last');
  for (const [key, value] of Object.entries(values)) {
    let $cell = $lastRow.find('[data-col-id=' + key + ']').find(
        '.content-editable');
    $cell.empty();
    $cell.append(`${value}`);
    $cell.append(`<br>`);
    $cell.trigger('input')
  }

(values has the column id as key)
It’s working in my context, but i don’t know if its the right way to do that :smiley:

Can you explain what you’re trying to achieve. We have APIs for all of that, no need to use jQuery.

I receive a new rule, which i would like to add to the decision.

How can i call this api? Is there some documentation?

There is no documentation except for the code itself. Here’s a basic example of how to create and edit rules using the API: https://codesandbox.io/s/cranky-lamport-39t51?fontsize=14

Thank you so much, that was the starting point i was looking for :slight_smile:

1 Like