I use Golden Layout, so I want to change title of a specific stack component. When I add for example 2 stacks with 2 inputs and I change the title of the last element, the title changes in all the elements not in a specific stack.
here's the code:
var addGroupement = function(title) {
var newItemStack = {
id: 'stackId',
type: 'stack',
title: title,
content:[{
type: 'row',
title: title,
content:[{
type: 'stack',
componentName: 'template',
componentState: { templateId: 'stackH' }
}]
}]
};
$('#groupement').click(function(){
var add = myLayout.root.contentItems[ 0 ].addChild( newItemStack );
var stack = myLayout.root.getItemsById('stackId');
console.log(stack);
var input = $('<input type="text"/>');
$('#test').append(input);
input.on('change', function(event){
for(i=0; i<stack.length ; i++){
stack[i].contentItems[0].setTitle(input.val());
}
})
});
};
The result:
Could you help me please !!