Hello everyone,
I want to add a Select Box to the Properties Panel by making an Ajax call to the URL from which I receive the data and fill the box. Unfortunately, I get the error message
Cannot read property ‘ajax’ of undefined
in my code. This is my code:
import {EntryFactory, IPropertiesProvider} from '../bpmn-js/bpmn-js';
import {$, jQuery} from "jquery";
export class CustomPropsProvider implements IPropertiesProvider{
static $inject = ['translate', 'bpmnPropertiesProvider'];
// Note that names of arguments must match injected modules, see InjectionNames.
constructor(private translate, private bpmnPropertiesProvider) {
/**
var http = new XMLHttpRequest();
http.onreadystatechange=function(){
if(http.readyState == XMLHttpRequest.DONE){
alert(http.responseText);
}
console.log(http.responseText);
http.open("GET", "test", true);
http.send();}
*/
}
getTabs(element) {
return this.bpmnPropertiesProvider.getTabs(element)
.concat({
id: 'custom',
label: this.translate('Custom'),
groups: [
{
id: 'customText',
label: this.translate('customText'),
entries: [
EntryFactory.textBox({
id: 'custom',
label: this.translate('customText'),
modelProperty: 'customText'
}),
EntryFactory.selectBox({
id : 'example',
description : 'example desc',
label : 'example',
options:[],
selectOptions: function(element){
var options = [];
jQuery.ajax({
url:{http://example.org,
function(result){
options = result;
},
async: false
}});
return options;},
setControlValue: true,
modelProperty : 'example'
})
]}]
})
}
}
Thank you in advance:)