0% found this document useful (0 votes)
8 views2 pages

Usetrustedagent

The document describes creating a modal window with a combo box to select settings. It creates a combo box store and component, adds it to a container with hbox layout, and creates a modal window to display it. It handles selecting and resetting the combo box value and closes the window.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Usetrustedagent

The document describes creating a modal window with a combo box to select settings. It creates a combo box store and component, adds it to a container with hbox layout, and creates a modal window to display it. It handles selecting and resetting the combo box value and closes the window.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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