Hello! I need to replace the drop-down list in the service task with my custom one. I want to make a drop-down list with JavaClass so that you can simply select the java class.
I tried to do it with this code, and I need to hang up some kind of handler to redraw the drop-down list every time I access a service task.
function CreateCustomSelect() {
const container = document.querySelector('.bio-properties-panel-group-entries.open');
if(container) {
const divSelect = document.createElement('div');
divSelect.classList.add('bio-properties-panel-select');
const select = document.createElement('select');
select.classList.add('bio-properties-panel-input');
select.id = 'bio-properties-panel-javaClassType';
select.name = 'javaClassType';
const option1 = document.createElement('option');
option1.text = 'Java Class 1';
option1.value = 'value of java class 1';
const option2 = document.createElement('option');
option2.text = 'Java Class 2';
option2.value = 'value of java class 2';
const option3 = document.createElement('option');
option3.text = 'Java Class 3';
option3.value = 'value of java class 3';
select.appendChild(option1);
select.appendChild(option2);
select.appendChild(option3);
divSelect.appendChild(select);
const divJavaClassType = document.createElement('div');
divJavaClassType.classList.add('bio-properties-panel-entry');
divJavaClassType.setAttribute('data-entry-id', select.name);
divJavaClassType.appendChild(divSelect);
container.appendChild(divJavaClassType);
console.log('>>>New Select is added<<<');
const defaultJavaClass = document.getElementById('bio-properties-panel-implementationType');
defaultJavaClass.selectedIndex = 1;
if(defaultJavaClass.selectedIndex = 1) {
console.log('>>>defaultItem is done<<<');
}
const hideSelect = document.querySelector('.bio-properties-panel-select');
if(hideSelect) {
hideSelect.style.display = 'none';
console.log('>>>Select of Camunda-Modeler is Hidden<<<');
}
const selectValue = document.getElementById('bio-properties-panel-javaClassType');
const inputValue = document.getElementById('bio-properties-panel-javaClass');
function updateInputValue() {
if (inputValue !== null) {
inputValue.value = selectValue.value;
}
}
select.addEventListener('change', updateInputValue);
}
}