1

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>',
},   
user7282
  • 5,106
  • 9
  • 41
  • 72

2 Answers2

1

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.

Samal
  • 11
  • 2
0

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.

ThinkFloyd
  • 4,981
  • 6
  • 36
  • 56