我如何...如何在extjs 3.4中获取文本字段值 [英] How do I...How to get textfield value in extjs 3.4

查看:85
本文介绍了我如何...如何在extjs 3.4中获取文本字段值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是ExtJS的新手。请给我以下查询。



我有一个网格,在网格中我在网格工具栏上有一个文本框。我想得到textfield值并将其发送到servlet文件。



如何获取extjs中的文本框字段值?



先谢谢。

Hi Everybody,
I am new to ExtJS. Please suggets me for below query.

I have a grid and in the grid I have one textbox on the toolbar of grid. I want to get the textfield value and sent that to servlet file.

How I can get the textbox field value in extjs?

Thanks in Advance.

推荐答案

try this

Ext.create('Ext.window.Window', {
  bodyPadding: '5 5 5 5',
  items: [
    {
      xtype: 'textfield',
      name: 'firstName',
      emptyText: 'First Name',
      width: 250
    },
    {
      xtype: 'button',
      text: 'click me',
      handler: function() {
        //WAY1
        var value1 = Ext.ComponentQuery.query('textfield[name=firstName]')[0].getValue();
        console.log(value1);

        //WAY2
        var value2 = this.up('window').down('textfield[name=firstName]').getValue();
        console.log(value2);
      }
    }
  ]
}).show();


这篇关于我如何...如何在extjs 3.4中获取文本字段值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆