Reputation: 5196
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
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
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