You are on page 1of 2

useTrustedAgent: {

display: 'leftCheckBox',
getDisplay: function (values) {
var isHidden = !
values.dataContext.canShowTrustedAgentCheckbox;
var isReadOnly = values.getProp('isEdit');
return {
label: _$QL('Use Trusted Agent'),
value: values.getProp('useTrustedAgent'),
hidden: isHidden,
readOnly: isReadOnly
};
},
Submit: function (proxy, template, ctrl) {
// Create a new store for the combo box
var comboStore = new Ext.data.SimpleStore({
fields: ['value', 'display'],
data: [
['LDAP', 'Setting 1'],
['TA', 'Setting 2'],
// Add more settings as needed
]
});

// Create a combo box


var comboBox = new Ext.form.ComboBox({
fieldLabel: 'Select Setting',
store: comboStore,
valueField: 'value',
displayField: 'display',
mode: 'local',
triggerAction: 'all',
forceSelection: true,
selectOnFocus: true,
allowBlank: false,
labelWidth: 120 // Adjust the label width as needed
});

// Create a container with hbox layout to control the width


var container = new Ext.Container({
layout: 'form',
items: [comboBox],
margin: 'auto'
});

// Create a modal window with reduced width


var settingsWindow = new Ext.Window({
title: 'Select Setting',
layout: 'fit',
modal: true,
autoScroll: false, // Disable auto scrolling
width: 400, // Set the desired width here
items: [container],
buttons: [{
text: 'OK',
handler: function () {
var selectedSetting = comboBox.getValue();

if (selectedSetting) {
settingsWindow.close();

// Existing Submit code

// Add code to handle the selected setting


from ComboBox

template.panel.host.loadTrustedAgentLdapSettings(template, selectedSetting);
} else {
Ext.Msg.alert('Error', 'Please select a
setting before clicking OK.');
}
}
}, {
text: 'Cancel',
handler: function () {
comboBox.reset(); // Reset the combo box to its
previous state
settingsWindow.close();
}
}]
});

// Open the window when needed, e.g., on the 'click' event


of a button
settingsWindow.show();
}
},

You might also like