表单控件的代码:[code="java"]{
xtype : 'text',
name : 'nodepath'
}[/code]
获取值得代码:[code="java"]this.FormPanel.getForm().findField('nodepath').getValue()[/code]
当xtype类型为textfield、field等类型的时候就能取得到,但是类型是label、text就取不到值Cannot call method 'getValue' of null
求解如何取得label控件的值?
label没有 getValue 方法,有text
text 没有 getValue 方法 有getFieldLabel
首先ExtJS4没有xtype为text的组件,只有textfield和textarea。label的值在表单提交时是无法提交的,所以this.FormPanel.getForm().findField('nodepath') 无法获取值,只能通过Ext.getCmp("labelid");才能用组件读取其属性
我记得label控件有一个getText()方法,可以获取label中的显示值