7?????1????7??????

????: extjs4 comboBox not shows records from remote store

  1. #1
    Sencha User
    ????
    Aug 2011
    ???
    9
    Vote Rating
    0
      0  

    ????? extjs4 comboBox not shows records from remote store

    I have used spring mvc and want to fill combobox from remote store(extjs 4.0.2), but combo not filled or not display records. this is my code

    PHP???:
    Ext.define("countries", { 
        
    extend'Ext.data.Model'
        
    fields: [
            {
    name'code'},
            {
    name'name'}
        ]
                }); 
                
    var 
    contr Ext.ModelManager.getModel('countries');             
                
    var 
    countryStore = new Ext.data.Store({  
        
    model:contr,
        
    autoLoad:true,
        
    proxy: {  
            
    type'ajax'    ,              
            
    url:'combo.action'
        
    },                
        
    reader: {
            
    type'json',   
            
    root'data'
        

    });  
                              
                var 
    countryCmb2=    new Ext.form.ComboBox( {
        
    storecountryStore,
        
    id:'countryCmb2',
        
    fieldLabel'Choose country',               
        
    displayField'code',
        
    valueField'name',
        
    triggerAction:'all'           ,
        
    queryMode:'local'
    }); 
    problem is : this store is filled ,it has loaded values correctly. but combobox is not filled, it is empty, maybe not refreshed.
    I have spent 2 days for that, but no result.
    Is there some bug?
    please help!
    Thanks

  2. #2
    Sencha User arthurakay's Avatar
    ????
    Sep 2008
    ??
    Antioch, IL
    ???
    1,516
    Vote Rating
    77
      0  

    ?????

    Your proxy/reader is not defined correctly. Reader needs to be inside of proxy... check the API docs.

  3. #3
    Sencha User
    ????
    Aug 2011
    ???
    9
    Vote Rating
    0
      0  

    ?????

    Thanks. it works!

  4. #4
    Sencha User
    ????
    Nov 2011
    ???
    2
    Vote Rating
    1
      1  

    ?????

    I have the same problem. Where is the Error?

    the model

    PHP???:
    Ext.define('AbyssJS.model.Anrede', {
        
    extend'Ext.data.Model',
        
    fields: ['code','name']
    }); 
    the store

    PHP???:
    Ext.define('AbyssJS.store.Anredes', {
        
    extend 'Ext.data.Store',
        
    model 'AbyssJS.model.Anrede',
        
    autoLoad true,
        
    proxy : {
            
    type 'ajax',
            
    url 'contact/view2.action',
            
    reader : {
                
    type 'json',
                
    root 'states'
            
    }
        }
    }); 
    the view
    PHP???:
    {
                    
    xtype 'combo',
                    
    id 'statesCombo',
                    
    store Ext.create('AbyssJS.store.Anredes'),
                    
    displayField 'name',
                    
    valueField 'code',
                    
    hiddenName 'codeId',
                    
    typeAhead true,
                    
    queryMode:'local',
                    
    fieldLabel 'Anrede',
                    
    anchor '100%',
                    
    forceSelection true,
                    
    triggerAction 'all',
                    
    emptyText '......',
                    
    selectOnFocus true
                



    Thank you!

  5. #5
    Sencha Premium Member skirtle's Avatar
    ????
    Oct 2010
    ??
    UK
    ???
    3,790
    Vote Rating
    390
      0  

    ?????

    Please don't post unrelated questions on old threads. You'd be better starting a new thread in the Q&A forum instead.

    From looking at your configs I don't see an obvious mistake. What does the JSON response from your server look like? Do you see the request to the server in Firebug or a similar tool?

    When you click the trigger what do you see? Is the drop-down 0px tall or does it have blank entries?

  6. #6
    Sencha User
    ????
    Nov 2011
    ???
    2
    Vote Rating
    1
      0  

    ?????

    Ok next time I create a new post. I debug with Firebug and came across the following problem:

    PHP???:
    reader.read is not a function            result reader.read(me.extractResponseData(response)); 
    Do you have a solution?

  7. #7
    Sencha Premium Member skirtle's Avatar
    ????
    Oct 2010
    ??
    UK
    ???
    3,790
    Vote Rating
    390
      0  

    ?????

    That is interesting. As far as I can tell there's nothing wrong with what you're doing.

    What version of ExtJS are you using? It should work whichever version you're using but it'll help me to reproduce your problem.

    Can you try removing the model from the store and adding the fields directly to the store instead? I've seen people report that this fixed problems in the past though I've never observed it myself.

    Something else to check is that all of your JS files are being included. I don't know where the file boundaries lie or how you're loading them but you should check everything is being included.

    The other thing to confirm is that it is this store that is giving you that error. Try that store in complete isolation. It should try to load the data even without the combobox or any of the rest of your application.

?????

  • ???????????????????
  • ????????????
  • ???????????????????
  • ?????????????
  •