value: ''
});
- var insideUpdate = false;
-
var sm = Ext.create('Ext.selection.CheckboxModel', {
mode: 'SIMPLE',
listeners: {
selectionchange: function(model, selected) {
- if (!insideUpdate) { // avoid endless loop
- var sel = [];
- Ext.Array.each(selected, function(record) {
- sel.push(record.data.vmid);
- });
+ var sel = [];
+ Ext.Array.each(selected, function(record) {
+ sel.push(record.data.vmid);
+ });
- insideUpdate = true;
- vmidField.setValue(sel);
- insideUpdate = false;
- }
+ // to avoid endless recursion suspend the vmidField change
+ // event temporary as it calls us again
+ vmidField.suspendEvent('change');
+ vmidField.setValue(sel);
+ vmidField.resumeEvent('change');
}
}
});
});
var update_vmid_selection = function(list, mode) {
- if (insideUpdate) {
- return; // should not happen - just to be sure
- }
- insideUpdate = true;
if (mode !== 'all') {
sm.deselectAll(true);
if (list) {
});
}
}
- insideUpdate = false;
};
vmidField.on('change', function(f, value) {