PDA

View Full Version : Cannot get selected value from combobox



earist
16 Aug 2011, 7:14 PM
- I create panel that contains gear tool for select view option

27506

- When click gear, Option window will be shown. You can select view on the window.
27507

- When click Save button, message dialog will be shown and display selected value.
27508

but when I select other view (such as Thumbnail or Detail), the dialog still display "View = list" .

See following code



Ext.define('Me.Portlet.ProjectList', {
extend: 'Ext.panel.Panel',
alias: 'widget.portlet',
layout: 'fit',
anchor: '100%',
frame: true,
closable: true,
collapsible: true,
animCollapse: true,
draggable: true,
id : 'project_list',
title : 'Project List',
layout : 'anchor',


initComponent: function(){

Ext.apply(this, {
tools : [ {
xtype: 'tool',
type: 'gear',
handler: function(e, el, panel, tool) {

var win;
if (!win){
var form = Ext.create('Ext.form.Panel', {
padding : '10px 10px 10px 10px',
labelWidth : 50,
labelSeparator : ':',
items: [
{
xtype : 'fieldcontainer',
combineErrors: true,
msgTarget: 'side',
fieldLabel: 'View',
defaults: {
hideLabel: true
},
items : [
{
width: 50,

xtype: 'combobox',
mode: 'local',
value: 'list',
triggerAction: 'all',
forceSelection: true,
editable: false,
fieldLabel: 'View',
name: 'View',
displayField: 'label',
valueField: 'value',
queryMode: 'local',
store: new Ext.data.Store({
fields : ['value', 'label'],
data : [
{value : 'list', label: 'List'},
{value : 'thumbnails', label: 'Thumbnails'},
{value : 'details', label: 'Details'}
]
})
}
]
}
],
buttons: [
{
text : 'Save',
handler: function() {
var f = form.form;
var s = '';
if (f.isValid()) {
Ext.iterate(f.getValues(), function(key, value) {
s += Ext.util.Format.format("{0} = {1}<br />", key, value);
}, this);

Ext.Msg.alert('Form Values', s);
}
}
},

{
text : 'Close',
handler : function() {
this.up('window').hide();
}
}
]
});

win = Ext.widget('window', {
title : 'Options',
layout : 'fit',
width : 300,
height : 120,
closable: true,
closeAction: 'hide',
plain : false,
modal : true,
shim : true,
stateful : true,
items: form

});
}
if (win.isVisible())
win.hide();
win.show();
}
}
]
});
this.callParent(arguments);
}
});



Thank in advance.

jjerome
18 Aug 2011, 7:42 AM
Is this Ext JS? This is the Sencha Touch section.

earist
18 Aug 2011, 5:25 PM
Oh! sorry, I posted at incorrect section.
This is about Ext JS question.
Can anyone move this topic to correct section?