`

Extjs control the html value

 
阅读更多

这段代码非常经典,我这里给出

 

 

Ext.define('app.view.myView', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.myView',
    title: 'My Cool Panel',
    html: '<div><a href="#">This link will open a window</a></div><br /> <label for="myInput">Type here: </label><input name="myInput" type="text" value="" />',
    initComponent: function(){
        var me = this;
        me.callParent(arguments);
    }
});

 

 

 

 

Ext.define('app.controller.myController', {
extend: 'Ext.app.Controller',

    init: function() {
        this.control({
            'myView': {
               afterrender: function(cmp){
                    var me = this; //the controller
                    var inputs = cmp.getEl().select('input'); // will grab all DOM inputs
                    inputs.on('keyup', function(evt, el, o){
                        me.testFunction(el); //you can call a function here
                    });

                    var links = cmp.getEl().select('a'); //will grab all DOM a elements (links)
                    links.on('click', function(evt, el, o){ 
                        //or you can write your code inline here
                        Ext.Msg.show({
                            title: 'OMG!',
                            msg: 'The controller handled the "a" element! OMG!'
                        });
                    });
                }
            }   
        });
    },
    testFunction: function(el) {
        var str = 'You typed ' + el.value;
        Ext.Msg.show({
            title: 'WOW!',
            msg: str
        });
    }   
});

 

 

越看我就感觉我什么也不是,这个都想不出来。。。啊啊啊啊啊啊啊啊啊 

0
2
分享到:
评论

相关推荐

    基于extjs的.NET3.5控件Coolite 1.0.0.34580(Preview预览版)

    基于extjs的.NET3.5控件Coolite 1.0.0.34580 (Preview预览版), *************************************************** * Version 1.0.0 升级日志 * *************************************************** 1. ...

    实现一个Asp

    [DefaultValue(1)] public int NumberOfSteps { get; set; } ``` 4. **处理生命周期事件**: 实现Load、PreRender等事件,以在适当的时间点执行回退逻辑。这可能包括检查HTTP上下文,判断是否可以回退,并更新状态。...

    WinForm轻松实现自定义分页

    public partial class Paging : UserControl { public Paging() { InitializeComponent(); } public delegate void EventPagingHandler(EventArgs e); public event EventPagingHandler EventPaging; ...

    java基础题

    包括面向对象特性、集合操作效率、字符串比较、Hibernate映射、编码解码、Spring的IoC、方法参数、抽象类和接口、异常处理、final修饰符、finally块、JSP隐含对象、Servlet参数获取、Filter、Struts2参数获取、HTML...

    AJAX技术介绍 教你入门

    - **控制 (Control):** JavaScript 是 AJAX 的核心,负责处理用户交互以及发送请求。 - **视图 (View):** DHTML 负责显示数据,通常使用 HTML 和 CSS 来构建界面。 - **模型 (Model):** 数据存储于后端或前端,常用...

    unigui0.83.5.820

    - 0000728: Disabled UniEdit does not receive values assigned with Control.Text := Value - 0000720: Tag property for DBGrid Columns - 0000723: DBGrid: numeric column is not aligned to right - ...

    struts+spring+hibernate

    &lt;param-value&gt;/WEB-INF/spring/*.xml&lt;/param-value&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener ``` 这里定义了 Spring 的配置文件位置,并通过 `ContextLoaderListener` ...

    ExtAspNet_v2.3.2_dll

    -为所有控件增加Focus(覆盖Control默认的Focus函数)和GetFocusReference函数。 -增加示例(other/custom_postback.aspx)(feedback:thebox)。 -如何自定义Javascript脚本和C#处理函数来响应键盘事件。 -为Tree...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -为所有控件增加Focus(覆盖Control默认的Focus函数)和GetFocusReference函数。 -增加示例(other/custom_postback.aspx)(feedback:thebox)。 -如何自定义Javascript脚本和C#处理函数来响应键盘事件。 -为Tree...

Global site tag (gtag.js) - Google Analytics