1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default Unanswered: How to get combobox display 1st element ?

    Unanswered: How to get combobox display 1st element ?


    This is working code : panel with combobox apeears. Clicking on
    combbox gives me items from servlet. BUT INITALLY combobox is blank.
    I'd like to see 1-st item in combobox right after panel with combo appears on screen.
    Please help!

    PHP Code:
    Ext.define('Test.store.ComboStoreServlet', {
        
    extend'Ext.data.Store',
        
    constructor: function(cfg) {
            var 
    me this;
            
    cfg cfg || {};
            
    me.callParent( [ Ext.apply ({
                
    autoLoadtrue,
                
    storeId'MyJsonStore1',
                
    proxy: {
                
    type'ajax'
                
    url:  'http://localhost:8080/Test/Test',  reader:      {
                 
    type'json',
                
    root'rows'
    } },     fields: [ {name'id'},{name'name'}
    ]
     }, 
    cfg)]); 
       }});

    Ext.application({    name'Test',
    launch: function() {Ext.create('Test.store.ComboStoreServlet');
    Ext.create('Ext.panel.Panel', { layout'absolute',
     
    id:        'panel_id'height300,
     
    width500,
    title:'App launch 1'
    renderToExt.getBody(), 
    items: [ {
     
    xtype'combo',
     
    fieldLabel'Label'
    displayField'name'
    id:'myc',
    store'MyJsonStore1'
    valueField'id',
    x20,
    y40,
    listeners:{
          
    beforerender:function(combo,opts){
                        
    alert(combo.store);
                     }
               }           }  ]          }); 
       }
    }); 

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Please post in the appropriate forum. I have moved this to the Ext JS 4 Q&A forum.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So you want the first item in the store to be the value of the combobox?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    So you want the first item in the store to be the value of the combobox?
    Yes , I want somebody to help with this

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by user14 View Post
    Yes , I want somebody to help with this
    Um... I am, just needed to ask a question first.

    You have to get the first item in the store via:

    Code:
    store.getAt(0)
    Then you have to set the value of the combo with the field value:

    Code:
    combo.setValue(rec.get(combo.valueField))
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #6
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Um... I am, just needed to ask a question first.

    You have to get the first item in the store via:

    Code:
    store.getAt(0)
    Then you have to set the value of the combo with the field value:

    Code:
    combo.setValue(rec.get(combo.valueField))
    Here is what I added to the listeners ( in code above): and it still the same ( not displaying 1-st element)
    listeners:{

    beforerender:function(combo,opts){
    store.getAt(0);
    combo.setValue(rec.get(combo.valueField));
    }
    }

    My servlet (I see it ) replies with :
    TestServlet doGet {rows:[{"id":"1","name":"John"},{"id":"2","name":"Smith"} ]}
    That's what i see now
    So I'd like 1.JPG
    to see when my app loads
    2.JPG

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You didn't define the rec variable from the getAt call on the store
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  8. #8
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    that is not working also:
    beforerender:function(combo,opts){
    rec=combo.store.getAt(0);
    combo.setValue(rec.get(combo.valueField));
    }
    }

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,724
    Answers
    3359
    Vote Rating
    752
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the store loaded? Any errors?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  10. #10
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default


    I see my servlet responds to request.
    that is not working also
    combo.store.load();
    rec=combo.store.getAt(0);
    combo.setValue(rec.get(combo.valueField));
    It seems to be simple task - but ??? to resolve it ?

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar