1
当inputbox1为空时,我在侦听器上获得空值。我能做些什么来获得空字符串“”,而不是空值?extjs,在侦听器上获得空值而不是空字符串
谢谢。以下是我的代码。我想我可以使用该函数来转换它,但我不知道该函数放在extjs代码中的位置。
感谢
var form = new Ext.FormPanel({
renderTo: 'SimpleForm',
title:'testing',
items: [{
xtype:'fieldcontainer',
layout:'hbox',
combineErrors: true,
msgTarget: 'side',
defalts:{
hideLabel:false,
labelAligh: 'right'},
items:[{
itemId: 'testing1',
fieldLabel: 'Test1',
name: 'test1',
value:'',
displayField:'name',
xtype:'combo',
valueField: 'name',
store: 'input1store',
listeners:{
'change':{
fn:function(combo,value){
Ext.getCmp('combo-testing2').clearValue();
input2store.setProxy({
type:'ajax',
url:'www.requesturl.com?format=json&source2'+combo.getValue(),
reader:{
type:'json',
root:'xml.result'
}
});
input2store.load();
}
}
}
},{
itemId: 'testing2',
value:'',
fieldLabel:'testing2',
displayField: 'name',
xtype:'combo',
name:'testing2',
valueField:'name',
id:'combo-testing2',
listeners:{
onclick :{
single:true,
fn:function(){
input2store.load();
}
}
}
}]
}]
})
伟大的想法,但我只是更换Ext.valueFrom(NULL, ''),用于combo.getValue(),我不再获得来自inputbox1值。如果可能的话,我对这个extjs很新,你能告诉我究竟我需要做什么改变吗?谢谢你 – shiro
对不起,你是对的,我不打算在我的例子中留下'null'。我更新了我的答案中的片段。这是你如何取代它? – rixo
谢谢,它工作得很好。 – shiro