dominik@föhl-online.de
unread,Mar 19, 2015, 10:22:35 AM3/19/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to camunda-...@googlegroups.com, domini...@acando.de
Hi Sebastian,
thanks for the advice. Finally I got it working.
But the user guide and the documentation in the config.js are inconsistent. The code snippet in the user guide includes a "modules.export" which isn't available.
Also I had some problems using the "S" function to deserialize a JSON string, I switched over to using JavaScripts "JSON.parse()", which worked fine.
If anyone else tries to use metawidget in an embedded form, here are the neccesary steps:
1. Moddify %CAMUNDA_HOME%/app/tasklist/scripts/config.js to include:
customScripts: {
ngDeps: [
"metawidget"
],
deps: [
"metawidgetcore",
"metawidgetajs"
],
paths: {
"metawidgetajs": "metawidget/metawidget-angular.min",
"metawidgetcore": "metawidget/metawidget-core.min"
}
}
2. Download "metawidget-core.min.js" and "metawidget-angular.min.js" and put them in "%CAMUNDA_HOME%/app/tasklist/scripts/metawidget"
3. Create your embedded form like this one, remember to change the forms name, aswell as the variable which contains the JSON data:
<form name="FORMNAME">
<script cam-script="" type="text/form-script">
camForm.on('form-loaded', function()
{
camForm.variableManager.fetchVariable('JSONVAR');
});
camForm.on('variables-fetched', function() {
$scope.mwdata= JSON.parse(camForm.variableManager.variable('JSONVAR').value);
});
</script>
<metawidget ng-model="mwdata"/>
</form>
( 4. Maybe some cleanup on the JSON is necessary, in my case, the Object was encapsulated in an array, so I've added an arrayindex e.g. "ng-model="mwdata[0]"")