View Full Version : scoping problem...

26 Nov 2013, 11:02 PM
I have a simple code for creation of combo box in ext js using ext-js 3.

I am loading data into store of combo box , on the event of focus. For testing purpose I have created a simple variable which contains all the data required for
store and subsequently for combo box. But I am not able to access myData variable in following code. Please tell my how can I access that variabl into listener.

var proxy = new Ext.data.HttpProxy({
url: '/local'

var myData = {PersonList :[{myId:'pankaj', displayText:'jain'},{myId:'Chetan',displayText:'Jain122343'}]};
var reader = new Ext.data.JsonReader({
fields: [
{name: 'myId',mapping:'myId'}
,{name: 'displayText',mapping:'displayText'}
root: 'PersonList'

var store = new Ext.data.Store({
proxy : proxy,
reader : reader


var combo2 = new Ext.form.ComboBox({
mode: 'local',
fieldLabel : 'Combo with Remote Data',
renderTo : document.body,
store: store,
valueField: 'myId',
displayField: 'displayText',
triggerAction: 'all',
listeners : {
'focus' : function(){


3 Dec 2013, 12:59 PM
Is this just for this demo or are you loading the store on focus?