相关疑难解决方法(0)

extjs按钮范围

我试图了解以下场景中的范围.拨打电话时searchTerms,thisscope:this指的是searchTerms功能而非面板本身.它似乎与我从其他例子中观察到的不同.我可以知道我犯了什么错误吗?

function searchTerms(){
       var searchGrid = new Ext.grid.GridPanel({

        });

        var searchPanel = new Ext.form.FormPanel({
            region: 'south',
            height:150,
            items:[
            {
                xtype: 'textfield',
                fieldLabel: 'Keywords',
            },{
                xtype: 'textfield',
                fieldLabel: 'Label',
            },{
                xtype: 'datefield',
                fieldLabel: 'Valid till'
            },new Ext.Button({
                text: 'crawl',
                scope: this,
                handler: function(b,e){
                    Ext.Ajax.request({^M
                        url: '/discovery/tsearch',^M
                        params: {^M
                            keywords: this.items[0].getValue(),
                            label: this.items[1].getValue(),
                            valid: this.items[2].getValue(),
                        },
                    });
                }
            }),],
        });

        var regionPanel = new Ext.Panel({
            title: 'search',
            layout: 'border',
            items: [searchPanel, searchGrid]
        });

    return …
Run Code Online (Sandbox Code Playgroud)

javascript extjs extjs3

2
推荐指数
1
解决办法
2556
查看次数

标签 统计

extjs ×1

extjs3 ×1

javascript ×1