PDA

View Full Version : static data store changes



greenleaf
8 Mar 2016, 2:43 PM
Hello Gurus,

I am trying to change the static data store used for combo box , but its not reflecting . Following is the code snippet :

var nano = Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data : [
{"value":"", "name":"Any"},
{"value":"true", "name":"Y"},
{"value":"false", "name":"N"}
]
});


Ext.define('Exmaple1.view.NanotechnologyCombo', {
extend : 'Ext.container.Container',
alias : 'widget.pmnanotechnologycombo',

layout : {
type : 'hbox',
align : 'middle'
},
isStateful : false,
initComponent : function() {
var me = this;
Ext.applyIf(me, {
items : [{
xtype : 'label',
text : 'Nanotechnology:',
margins : '0 10 0 0',
forId : 'nanotechnologyInput',
width : 130
}, {
xtype : 'combo',
store : nanoStore,
queryMode : 'local',
displayField : 'name',
valueField : 'value',
name : 'nanotechnology',
itemId : 'nanotechnology',
inputId : 'nanotechnologyInput',
fieldLabel : 'Nanotechnology',
boxLabel : '',
hideLabel : true,
submitValue : true,
stateEvents : ['select', 'change'],
stateful : this.isStateful,
stateId : 'nanotechnologycheckbox',
getState : function() {
return {
value : this.value
};
},
applyState: function(state){
this.setValue(state.value);
}
}]
});


me.callParent(arguments);
}


});
Now I am defining new store and trying to assign that store to combo

var nanoStore = Ext.create('Ext.data.Store', {
fields: ['value', 'name'],
data : [
{"value":"", "name":"All"},
{"value":"true", "name":"Y"},
{"value":"false", "name":"N"}
]


});

changing store name to nanoStore and then binding

combo.bindStore(nanoStore);

somehow I am not getting changed store values in combo . Any expert advice? Thanks in advance!

greenleaf
8 Mar 2016, 2:45 PM
Sorry wrong Group! posting it in ext 4.X