PDA

View Full Version : static data store changes not reflecting



greenleaf
8 Mar 2016, 2:46 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!

jdkhamba
8 Mar 2016, 5:00 PM
Probably the correct store is not being accessed correctly. Hard to say just by looking at the code provided. Here is a working example of what you are trying to do:

https://fiddle.sencha.com/#fiddle/16s0

Also try to wrap code with code tags. (The "#" symbol in the html editor).

greenleaf
9 Mar 2016, 8:50 AM
Thank you so much jdkhamba ! I tried your solution, unfortunately its not working. There is another js wherein I am adding this component, not sure because of parent js the changes are not reflected :(

jdkhamba
9 Mar 2016, 8:55 AM
Post a working fiddle to demonstrate the issue.

greenleaf
9 Mar 2016, 9:17 AM
Actually I cant really use fiddle right now , as the code posted above is from different file and the component is getting called from another js. Here is parent file code:

Ext.application({ appFolder : 'resources/scripts/onade', requires : ['Onade.override.PagingToolbar',
'Ext.state.CookieProvider', 'Ext.ux.state.SessVarsProvider'], name : 'Onade', controllers : ['Projects'], launch : function() { Ext.create('Onade.view.ContentViewport', { layout : 'anchor', autoScroll : true, items : [{ xtype : 'pmnanotechnologycombo', columnWidth : 0.33, isStateful : true }] }); } });

greenleaf
10 Mar 2016, 9:05 AM
So here was the catch! we are using jdk5, oc4j,IE 10 along with extjs4x . Somehow changes suggested by jdkhamba were not getting reflected into IE, but same solution worked in firefox ! Need to check how can we get them in IE too.Thank you jdkhamba :)