1

リストを別のビュー (カルーセル レイアウト) にリンクしたいと思います。2. このブラケットには何を入れればよいですか?

                onItemDisclosure: function() {
                    [......]
                }

carousel.setActiveItem(x) のようなものを達成したいのですが、x は私のカルーセル コンテンツです。

4

2 に答える 2

0
onItemDisclosure: function(list, record, index) { 

//switch the view to carousel (my main content view) 
Ext.ComponentManager.get('comp').setActiveItem(1); 

//set active item for carousel according to chosen list 
Ext.ComponentManager.get('content').setActiveItem(index); 


}
于 2012-10-18T10:04:46.030 に答える
0

私はあなたの問題に取り組みました。これはあなたを助けるかもしれません。

app.js

        Ext.application({
            name: "FrontApp",

            models: ["mymodel"],
            stores: ["mystore"],
            controllers: ["FrontAppController"],
            views: ["front","carousel"],

            launch: function () {
                var frontView = {
                    xtype: "frontview"
                };
                var Carousel = {
                    xtype: "carousel"
                };

                Ext.Viewport.add([frontView,Carousel]);//views called by x-type

            }
        });

front.js

    Ext.define("FrontApp.view.front", {
    extend: "Ext.Panel",
    alias: "widget.frontview",

        config: {
            layout: {
                type: 'fit'
            },
            fullscreen: true,
            scrollable: true,
            items: [

            {
                    xtype: 'list',
                    itemId: 'myList',
                    scrollable: false,
                    itemTpl: '{firstName}',
                    store: 'mystore51',
                    onItemDisclosure: true,

            }
            ],
            listeners:
            [

                {
                  delegate: "#myList",
                  event: "disclose",
                  fn: "onListDisclose"
                }

            ]
            },


            onListDisclose: function (list, record, target, index, evt, options) {
                console.log("calling carousel..");
                this.fireEvent("carouselCommand", this,record, target, index, evt, options);

            }

    });

carousel.js

 Ext.define('FrontApp.view.carousel', {
extend: 'Ext.carousel.Carousel',
xtype: 'carousel',

config: {

    items: [
        {
            xtype: 'panel',
            html: 'hello1'
        },
        {
            xtype: 'panel',
            html: 'hello2'
        },
        {
            xtype: 'panel',
            html: 'hello3'
        }
    ]
}

 });

FrontAppController.js

        Ext.define("FrontApp.controller.FrontAppController", {
        extend: "Ext.app.Controller",
            config: {
                refs: {   
                    frontView: "frontview", 
                    carouselView:"carousel"         
                 },
                control: {
                frontView: { 
                        carouselCommand: "onCarouselCommand"
                     }
                 }
            },
            // Transitions
            slideLeftTransition: { type: 'slide', direction: 'left' },
            slideRightTransition: { type: 'slide', direction: 'right' },


             onCarouselCommand: function (list, record, target, index, e, eOpts) {  
                console.log("onCarouselCommand");
                 var a=this.getCarouselView().setActiveItem(index); // setting the carousel item according to list index.
                 Ext.Viewport.animateActiveItem(a, this.slideLeftTransition);
            },
             // Base Class functions.
            launch: function () {
                this.callParent(arguments);
                console.log("launch");

            },
            init: function () {
                this.callParent(arguments);
                console.log("init");
            }
        });
于 2012-10-18T07:11:18.883 に答える