【问题标题】:Display values when the Window is displayed显示窗口时的显示值
【发布时间】:2012-07-04 08:44:17
【问题描述】:

我想显示一个弹出窗口,上面显示一些从 PHP 服务器文件中获取的值。我不知道如何在窗口上显示项目。

我不知道为什么,但是在渲染视图时,控制器中的 console.log 消息 'method call' 没有显示出来。我认为这是因为我添加了click: this.methodcall(仅在单击按钮时才会调用它,但我希望在呈现视图时打印日志语句)

视图上没有显示任何内容,我认为这是因为我没有添加任何代码来在视图中显示它。

谁能帮我解决这个问题?

我的弹出窗口VIEW代码;

Ext.define('Project.view.user.Popupwin', {
    extend: 'Ext.window.Window',
    alias: 'widget.popupwin',
    layout:'fit',
    autoShow: true,
    initComponent: function() {
        this.store = 'Popupwin';
        this.items = [
            {
                xtype: 'form',
                items: [                    
                ]
            }
        ];     
        this.callParent(arguments);
    }
});

商店

Ext.define('Project.store.Popupwin',{
    extend:'Ext.data.Store',
    model:'App.model.Popupwin', 
    proxy: {
        actionMethods : {           
            read   : 'POST'         
        },
        type: 'ajax',
        url : 'loaddata.php',
        autoLoad: true
    }   
});

控制器

Ext.define('Project.controller.Popupwin',{
    extend: 'Ext.app.Controller',       
    stores:['Popupwin'],
    models:['Popupwin'],
    views:['DoctorView'],
    init: function(){
        console.log('executed');                
        this.control({              
            'popupwin': {
                click: this.methodcall
            }
        });             
        },
        methodcall: function() {
                            console.log('method call');
            this.getShowPopupwinStore().load();
        }
});

型号

Ext.define ('Project.model.Popupwin',{
    extend: 'Ext.data.Model',   
    fields:['fname','lanme']
});

【问题讨论】:

    标签: extjs extjs4 extjs-mvc extjs4.1


    【解决方案1】:

    窗口没有点击事件,所以不能监听。

    Ext.define('MyWindow', {
        extend: 'Ext.window.Window',
        afterRender: function(){
            this.callParent(arguments);
            this.el.on('click', this.fireClick, this);
        },
    
        fireClick: function(e, t){
            this.fireEvent('click', this, e);
        }
    });
    

    【讨论】:

    • 好的,但是我如何显示我将从数据库中获取的项目?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 2011-11-10
    相关资源
    最近更新 更多