0

パネルにいくつかの html (アルバム) を表示しようとしていて、水平スクロールにしたいと考えています。しかし、それは表示されません。それは私のパネルを非表示にします。私はそれを修正するために何時間も費やしました。私を助けてください 。

var panel = Ext.create('Ext.Panel', {

        scrollable: {
            direction: 'horizontal',
            directionLock: true
        },
        height:120,
        html: '<h2>Photo Albums</h2><ul><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="Cover Photos"></a><span>Cover Photos</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="holilongnameofholitotesthere"></a><span>sample</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_251.jpg" title="Kerala"></a><span>Kerala</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="Kerala"></a><span>Kerala</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="Kerala"></a><span>444</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="Kerala"></a><span>333</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_40285.jpg" title="Kerala"></a><span>222</span></li><li><a href="#" onclick=""><img src="http://assets.en.oreilly.com/1/eventprovider/1/_@user_102517.jpg" title="Kerala"></a><span>sample</span></li></ul>',
        });
    // add the list as an item to the viewport
    Ext.Viewport.add({
        layout: {
            type: 'vbox',
            pack: 'center'
        },
        items: [panel
        ]
    });
4

1 に答える 1

0

これを実現する最も簡単な方法は、Ext.List追加の CSS でコンポーネントを使用することです。

JavaScript は次のとおりです (データを含む非常に単純なリスト)。

Ext.application({
    launch : function () {
        Ext.Viewport.add({
            xtype: 'list',
            data: [
                { name: 'one' },
                { name: 'two' },
                { name: 'three' },
                { name: 'four' },
                { name: 'five' }
            ],
            itemTpl: '{name}'
        });
    }
});

そして、各項目をインラインにするカスタム CSS:

.x-list .x-list-inner {
    width: auto;
}
.x-list-container {
    white-space: nowrap;
}
.x-list-item {
    display: inline-block;
    width: 400px;
}

詳細については、こちらをご覧ください: http://www.sencha.com/forum/showthread.php?181298-Dataview-List-Horizo​​ntal-Scroll-Possible

于 2012-09-11T22:27:44.733 に答える