Update decision table by Javascript

I tried to update the outputs by skript in a webapp.
Simple example: we have a “pricelist” and have to raise all of the output prices at 10%.

Before:

INPUT            OUTPUT

ARTICLE   SIZE   PRICE
-------   ----   -----
shirt     S      25.00
shirt     M      28.00
shirt     L      31.00
jeans     S      50.00
jeans     L      60.00

After:

INPUT            OUTPUT

ARTICLE   SIZE   PRICE
-------   ----   -----
shirt     S      27.50
shirt     M      30.80
shirt     L      34.10
jeans     S      55.00
jeans     L      66.00

I can see the table by using dmn-js, but I don’t want our users to update every output manually.
So I have written javascript, that finds the outputs in the decision table and update the text of the divs to the new price. Works fine - BUT this is not recognized by the dmn-js, so the update doesn’t appear.

Do you have some idea for me??

Thanks a lot. Kind Regards

Florian

I’ve found the solution for this…
When you programatically change the output div - which is contenteditable - you have to fire the input event after that. Then the new values are stored by the dmn-js.

$(this).text(newValue);
$(this).trigger('input');

You should update the DMN model using the modeling API.

const modeling = dmnJS.getActiveViewer().get('modeling');

modeling.editCell(myCell, {
  text: 'Foo'
});

Hi Philipp,

thank you - interesting alternative. :slight_smile:
Seems to work too. I wish there would be a better documentation for the dmnJS and the options.

Kind Regards

Florian