Sencha touch 2 Sencha Touch selectfield change事件不使用不同的值但使用相同的文本
selectfield change事件不使用不同的值但使用相同的文本。 此处演示:-Sencha touch 2 Sencha Touch selectfield change事件不使用不同的值但使用相同的文本,sencha-touch-2,Sencha Touch 2,selectfield change事件不使用不同的值但使用相同的文本。 此处演示:- 查看源代码中的Input.js文件 setValue: function(newValue) { var oldValue = this._value; this.updateValue(this.applyValue(newValue)); newValue = this.getValue(); **if (String(newValue) != String(old
查看源代码中的Input.js文件
setValue: function(newValue) {
var oldValue = this._value;
this.updateValue(this.applyValue(newValue));
newValue = this.getValue();
**if (String(newValue) != String(oldValue) && this.initialized) {
this.onChange(this, newValue, oldValue);
}**
return this;
}
这是一个有效的解决方案。您好,我认为您应该修复代码的格式,并添加一个问题,目前还没有。用相同的测试保留两个字段的意义是什么?我的应用需要它。感谢sargis为我指出了正确的方向,我在下面发布了我的答案。我只是删除了字符串(newValue)!=字符串(oldValue)&&来自if语句。它正在工作。谢谢。
setValue: function(newValue) {
var oldValue = this._value;
this.updateValue(this.applyValue(newValue));
newValue = this.getValue();
**if (String(newValue) != String(oldValue) && this.initialized) {
this.onChange(this, newValue, oldValue);
}**
return this;
}
setValue: function(newValue) {
var oldValue = this._value;
this.updateValue(this.applyValue(newValue));
newValue = this.getValue();
//alert(newValue)
if (this.initialized) {
this.onChange(this, newValue, oldValue);
}
return this;
}