基于项目数量的sencha touch中数据视图列表的高度

时间:2013-01-23 14:16:13

标签: extjs sencha-touch-2

我需要根据项目数量调整sencha touch中数据视图列表的高度。到目前为止我所做的只是这个列表中的配置

    config: {
        fullscreen: true,
         height:'100%'
   store: 'CategoryListStoresecond',
        loadingText: "Loading ...",
        emptyText: "<div>No items found.</div>",
        onItemDisclosure: true,
        grouped: false,
        itemTpl : '<div id="{Name}"> <img src="{Image}" /> <!--<h2>{Name}</h2>--!><p>{Name}</p></div>',
},   

2 个答案:

答案 0 :(得分:1)

我认为你可以像

那样做
var store = list.getStore();

store.load( { callback: function(records, operation, success) {
    list.setHeight({items.height} * records.length);
});

我做了,它的确有效。但我认为你必须确保没有太多的记录。并且列表不可滚动。

无需在您的情况下设置全屏和高度。

答案 1 :(得分:0)

您可以尝试使用maxHeight&amp; minHeight如果你想要http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-cfg-maxHeight

此外,如果它覆盖在vbox布局内,您可以使用flex来控制高度。

相关问题