每当我点击spinnerfield, spinnerfield的值增加,我想动态地改变textfield的值
whenever i m click on spinnerfield the value increases of spinnerfield i want dynamically change the value of textfield value
在这段代码中,我想每当点击spinnerfield的值增加,spinnerfield的时间动态改变文本字段值的值。
Ext.setup
({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function()
{
new Ext.Panel
({
fullscreen:'true',
items:[
{
xtype : 'spinnerfield',
name:'sp',
width:'20%',
height:'13%',
minValue: 0,
},
{
xtype:'textfield',
name:'price',
height:'13%',
width:'8%',
html:'<b>350</b>',
}
]
});
}
});
您可以收听3个事件:'spin', 'spindown', 'spinup'。参考:http://docs.sencha.com/touch/1-1/# !/api/Ext.form.Spinner-event-spin
首先将"new Ext.Panel"更改为"var myppanel = new Ext.Panel",这样您就可以访问面板以获取文本字段并更改其内容。
然后为你的spinnerfield实现事件监听器:
{
xtype : 'spinnerfield',
name:'sp',
width:'20%',
height:'13%',
minValue: 0,
listeners: {
spin: function(thisSpinner, numberValue, directionString) {
// Get the text field:
var textField = yourPanel.items.get(1);
// Update the text field:
textField.setValue("your new value");
}
}
},
相关文章:
- 无法从 jQuery RSS Feed 中的 localStorage 动态替换类
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 动态分配GA增强型电子商务跟踪器
- onkeyup无法动态创建多个文本区域
- 使用javascript将动态表从一个html页面打印到另一个html页
- 如何使Javascript动态html表及其上的事件
- 动态地改变“”的URL;添加新项目”;链接使用javascript/jquery
- 如何在Bootstrap Modal中为动态点击生成的变量设置jade属性
- 如何使用javascript从主svg对象动态创建svg视图框
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 通过在Dojo mobile ViewController.openExternalView中动态更改打开同一外部视图的
- 如何在Google柱状图中动态添加行/列
- 困在逻辑中试图定位动态的东西
- 在动态创建的元素上获取对特定选择器的引用
- 如何动态插入jquery代码
- 使用Google Visualization动态调用构造函数
- 使用jQuery动态添加表并在其中动态添加行
- d3基于用户选择动态更新节点
- 使用JQuery的动态上下文菜单
- 每当我点击spinnerfield, spinnerfield的值增加,我想动态地改变textfield的值