0

「getEl()」メソッドが私のコードで機能しない理由を誰か教えてもらえますか?

通知コンテナ:

Ext.define('common.NotificationContainer', {
    extend: 'Ext.container.Container',
    alias: 'widget.NotificationContainer',
    border: true,
    layout: {
        type:'fit'
    },
    style: {
        zIndex: '999999'
    },
    defaultType: 'container',
    items: [{
        cls: 'notification-box',
        border: true,
        width: 500,
        items:[{
            html: ''
        },{
            layout: {
                type: 'vbox',
                align: 'center'
            },
            items: [{
                xtype: 'button',
                text: 'OK',
                minWidth: 75,
                margin: '10 0 0 0',
                handler: function() {
                    this.up().up().up().getEl().slideOut('t', { duration: 1000 });
                }
            }]
        }]
    }]
});

関数:

var con_notification = Ext.create('common.NotificationContainer');
var con_notification_box = con_notification.child();

con_notification_box.addCls(cls);
if (server_response == undefined) {
    con_notification_box.items.items[0].update('<p><span class="custom-msg">' + custom_msg + '</span></p>');
} else {
    con_notification_box.items.items[0].update('<p><span class="custom-msg"> ' + custom_msg + '</span><br /><br /><span class="server-response">Server Response:</span>' + server_response + '</p>')
}

con_notification.add(con_notification_box);
con_notification.getEl().slideIn('t', {
    easing: 'easeOut',
    duration: 1000
});

ご支援ありがとうございました!

よろしく、シャブ

4

1 に答える 1

7

このような小さなコードからエラーを検査するのは非常に困難getEl()ですが、コンポーネントがレンダリングされたときにのみ有効な要素を返すという事実があります。

それが役に立てば幸い。

于 2012-04-10T19:42:40.113 に答える