-
29 Aug 2011 10:59 PM #1
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
problem is : this store is filled ,it has loaded values correctly. but combobox is not filled, it is empty, maybe not refreshed.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( {
store: countryStore,
id:'countryCmb2',
fieldLabel: 'Choose country',
displayField: 'code',
valueField: 'name',
triggerAction:'all' ,
queryMode:'local'
});
I have spent 2 days for that, but no result.
Is there some bug?
please help!
Thanks
-
30 Aug 2011 09:39 AM #2
Your proxy/reader is not defined correctly. Reader needs to be inside of proxy... check the API docs.
-
30 Aug 2011 10:28 PM #3
-
18 Dec 2011 01:00 PM #4
I have the same problem. Where is the Error?
the model
the storePHPコード:Ext.define('AbyssJS.model.Anrede', {
extend: 'Ext.data.Model',
fields: ['code','name']
});
the viewPHPコード: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'
}
}
});
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!
-
18 Dec 2011 03:52 PM #5
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?
-
19 Dec 2011 05:31 AM #6
Ok next time I create a new post. I debug with Firebug and came across the following problem:
Do you have a solution?PHPコード:reader.read is not a function result = reader.read(me.extractResponseData(response));
-
19 Dec 2011 11:32 AM #7
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.


引用して返信
