1. #1
    Sencha User
    Join Date
    Sep 2010
    Posts
    38
    Answers
    1
    Vote Rating
    1
    earist is on a distinguished road

      0  

    Question Unanswered: Cannot get selected value from combobox

    Unanswered: Cannot get selected value from combobox


    - I create panel that contains gear tool for select view option

    1.Panel.jpg

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

    - When click Save button, message dialog will be shown and display selected value.
    3.Message Dialog.png

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

    See following code

    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.

  2. #2
    Touch Premium Member
    Join Date
    Mar 2011
    Location
    New Jersey, USA
    Posts
    130
    Answers
    4
    Vote Rating
    0
    jjerome is on a distinguished road

      0  

    Default


    Is this Ext JS? This is the Sencha Touch section.

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Posts
    38
    Answers
    1
    Vote Rating
    1
    earist is on a distinguished road

      0  

    Default


    Oh! sorry, I posted at incorrect section.
    This is about Ext JS question.
    Can anyone move this topic to correct section?

Thread Participants: 1