开发者

Animate (slide in) new panel to replace current panel's contents?

I'm trying to change the contents of an Ext.List. I'm trying to change the content to a new panel, although I don't need more list elements.

This seems to replace the contents, but how do I animate the change?

onItemDisclosure: function(record, btn, index) {
    console.log('Disclose more info for ' + record.get('name'));
    var panel1 = Ext.getCmp('panel-1');
    panel1.remove(Ext.getCmp('panel-1'));
    panel1.add(Ext.getCmp('panel-2'));
    panel1.doLayou开发者_如何学Got();
}


The best is to have the panel-1 and panel-2 as items in a different panel and then switch between them. Example:

    var detailPanel = new Ext.Panel({
            fullscreen: true,
            id:'detailPanel',
            scroll:'vertical',
            tpl:'<h1>{text}</h1>'
    });

   var list = new Ext.List({
        id :'theList',
        itemTpl : '{firstName} {lastName}',
        store: store1,
        width: '100%',
        scroll:false
    });

   var panel =  new Ext.Panel({
        fullscreen: true,
        id:'thePanel',
        layout: 'card',
        cardSwitchAnimation:'slide',
        scroll:'vertical',
         items:[list, detailPanel]
    });

Then you can update the detailPanel like this Ext.getCmp('detailPanel').update(record.data); and switch to it. Ext.getCmp('thePanel').setActiveItem(1,{type:'slide',direction:'left'});

The second argument of the setActiveItem is the animation config. object. http://dev.sencha.com/deploy/touch/docs/?class=Ext.Panel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜