Quote from: splittingred at Feb 24, 2011, 11:33 PM
If you’re trying to adjust the getlist call for the grid, yes.
Thanks Shaun.
This is a panel which has a textbox and button on it. Button runs a function, which need to use the textbox value. There is no result returned from function.
Here is the code
mycmp.panel.GenerateCode = function(config) {
config = config || {};
Ext.apply(config,{
id: 'test'
,url: mycmp.config.connector_url
,title: 'Create'
,autoHeight: true
,tbar: [{
xtype: 'textfield'
,name: 'contextkey'
,id: 'contextkey1'
,emptyText: ('enter context key')
,listeners: {
// 'change': {fn:this.search,scope:this}
}
},{
xtype: 'button',
text: 'Generate Code'
,handler: function(){this.generateCodefunction();}
,scope: this
}]
});
mycmp.panel.GenerateCode.superclass.constructor.call(this,config);
};
Ext.extend(mycmp.panel.GenerateCode,MODx.Panel,{
generateCodefunction: function(tf,nv,ov) {
var searchbox = Ext.getCmp('contextkey1');
this.getStore().setBaseParam('contextkey',searchbox.getValue());
var answer = confirm ("Are you sure to continue");
if (answer) {
MODx.Ajax.request({
url: this.config.url
,params: {
action: 'mgr/resource/generatecode'
}
,listeners: {
'success': {fn:function(r) {
MODx.msg.alert('DONE success');
this.refresh();
},scope:this}
}
});
} //if (answer)
else {alert('Not choosen');}
}
});
Ext.reg('mycmp-panel-generatecode',mycmp.panel.GenerateCode);
When I add a code like this
var searchbox = Ext.getCmp('contextkey1');
this.getStore().setBaseParam('contextkey',searchbox.getValue());
it doesn’t work.
I have the same code on another tab, which has a panel and a grid control(with a textbox and button on it.). The code works there, and I get the text box value with "$scriptProperties[’textfield’]"
May it be that the code works depending on the whether controls are on a panel or on a grid. I don’t know, maybe store object is not defined on panel control.