user7282
user7282

Reputation: 5196

Height of dataview list in sencha touch based on number of items

I need to adjust the height of dataview list in sencha touch based on number of items. What I have done so far is just this configs in that list

    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>',
},   

Upvotes: 1

Views: 2202

Answers (2)

Samal
Samal

Reputation: 11

I think you can do it like

var store = list.getStore();

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

I did and it works. but i think you have to make sure there is not too many records. and the list is not scrollable.

no need set the full screen and height in your case.

Upvotes: 1

ThinkFloyd
ThinkFloyd

Reputation: 5021

You can try using maxHeight & minHeight if you want http://docs.sencha.com/touch/2-1/#!/api/Ext.Component-cfg-maxHeight

Also if it is covering inside vbox layout you can use flex to control the height.

Upvotes: 0

Related Questions