1. #1
    Sencha User
    参加日付
    Aug 2011
    投稿数
    9
    Vote Rating
    0
    tamri is an unknown quantity at this point

      0  

    デフォルト extjs4 comboBox not shows records from remote store

    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 - Services Team arthurakay's Avatar
    参加日付
    Sep 2008
    位置
    Antioch, IL
    投稿数
    1,374
    Vote Rating
    37
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    デフォルト


    Your proxy/reader is not defined correctly. Reader needs to be inside of proxy... check the API docs.
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group

  3. #3
    Sencha User
    参加日付
    Aug 2011
    投稿数
    9
    Vote Rating
    0
    tamri is an unknown quantity at this point

      0  

    デフォルト


    Thanks. it works!

  4. #4
    Sencha User
    参加日付
    Nov 2011
    投稿数
    2
    Vote Rating
    1
    tobe77 is on a distinguished road

      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,616
    Vote Rating
    327
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      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
    tobe77 is on a distinguished road

      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,616
    Vote Rating
    327
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      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.