1. #1
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
    kortovos is on a distinguished road

      0  

    Lightbulb Example:Add slots, set selected values and read values picker

    Example:Add slots, set selected values and read values picker


    This picker enables a user to input the mileage of his car (up to 999.999). It show the basic functions of a picker (add slots, set selected values and read values).

    It adds 6 slots with values from 0 to 9 the first time it is shown. It also sets the selected values of the slots to those of the numberfield.
    PHP Code:
    (function() {
        var 
    picker = new Ext.Picker( {
            
    slots : [],
            
    height 300,
            
    width 500,
            
    stretchX false,
            
    centered true,
            
    useTitlesfalse,
            
    listeners : {
                
    beforeshow : function() {
                    if (
    this.items.length 6) {
                        var 
    one = {
                            
    name '1',
                            
    title '1',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    one.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(one);

                        var 
    two = {
                            
    name '2',
                            
    title '2',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    two.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(two);

                        var 
    three = {
                            
    name '3',
                            
    title '3',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    three.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(three);

                        var 
    four = {
                            
    name '4',
                            
    title '4',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    four.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(four);

                        var 
    five = {
                            
    name '5',
                            
    title '5',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    five.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(five);

                        var 
    six = {
                            
    name '6',
                            
    title '6',
                            
    data : []
                        };
                        for ( var 
    010i++) {
                            
    six.data[i] = {
                                
    text i,
                                
    value i
                            
    };
                        }
                        
    picker.add(six);
                        
    picker.doLayout();
                    }
                    var 
    mileage Ext.getCmp('Mileage').getValue();
                    
    mileage Ext.util.Format.leftPad(mileage6'0');
                    
    this.setValue({1:mileage.substring(0,1),2:mileage.substring(1,2),3:mileage.substring(2,3),4:mileage.substring(3,4),5:mileage.substring(4,5),6:mileage.substring(5,6)});
                },
                
    beforehide : function() {
                    var 
    mileage '';
                    
    Ext.iterate(this.getValue(), function(keyvalue) {
                        
    mileage += value;
                    })
                    
    Ext.getCmp('Mileage').setValue(mileage);
                }
            }
        });
        
        
    page = new Ext.form.FormPanel( {
            
    scroll 'vertical',
            
    style 'background:#F9F9F9',
            
    items : [ {
                
    xtype 'fieldset',
                
    id 'page',
                
    title 'General and technical information',
                
    //instructions: 'Please enter the information above.',
                
    items : [ {
                    
    xtype 'numberfield',
                    
    name 'car_mileage',
                    
    label 'Mileage',
                    
    id 'Mileage',
                    
    listeners : {
                        
    focus : function(field) {
                            
    field.fieldEl.dom.blur();
                            
    picker.show(field);
                        },
                        
    afterrender : function(c) {
                            
    c.fieldEl.dom.readOnly true;
                        }
                    }
                }]
            } ]
        });
    })(); 

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    12
    Vote Rating
    0
    greenFeather is on a distinguished road

      0  

    Default thanks for that

    thanks for that


    now I understand how to get a picker in a form.

Similar Threads

  1. [FIXED-271] Ext.Picker with slots value not working
    By ankuravlani in forum Sencha Touch 1.x: Bugs
    Replies: 11
    Last Post: 12 Jul 2011, 8:13 AM
  2. picklist names, multivalue, add to selected values
    By flyingman in forum Ext.nd for Notes/Domino
    Replies: 1
    Last Post: 5 Mar 2011, 10:08 AM
  3. Replies: 1
    Last Post: 21 Jul 2010, 9:25 AM
  4. How to get selected CheckColumn values(or) true values
    By Buddy_charu in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 28 Aug 2008, 3:33 AM
  5. Any ways to set PropertyGrid values to read-only?
    By aendo in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 15 Nov 2007, 11:32 PM

Thread Participants: 1