Ext.List Screen fit issue

115 Views Asked by At

In my sencha based application I want to make ext.list size depends on the device screen. Here the code which I have used.

 var tab=  Ext.create('Ext.List', {
                                 width: 320,//Size wants to change depends on device display
                                 height: 290,//Size wants to change depends on device display
                                 id : 'itemList',
                                 disableSelection: true,
                                 selectedItemCls:'',
                                 itemTpl: ['<div style="margin:0px;" >'+
                                           '<table style="margin:0px;padding:0px;height:40px;" width="100%" >'+
                                           '<tr><td style="padding-left:2px;width:20%;"><span><img src="data:image/jpeg;base64,{itemImage}" height="42" width="42"/>'+
                                           '</span></td><td><span><b><font size="3">{itemName}</font></b><br>{itemDesc}</span></td>'+
                                           '<td style="padding-left:2px;width:20%;">'+
                                           '<img src="resources/img/arrow.png" onclick="viewgiftdetails(\'{itemID}\')"/>'+
                                           '</td></tr></table></div>'].join(),
                                 listeners : {
                                 itemtap: function (list, index, item, record, senchaEvent) {
                                 var data = record.getData();
                                 var itemID = data.itemID;
                                 App.gvars.itidi=data.itemID;
                                 var itemPurchased = data.itemPurchased;
                                 var imgref=data.itemImage;
                                 viewgiftdetails(itemID);
                                 Ext.getCmp('homepnl').setActiveItem({
                                                                     title: 'My item',
                                                                     items: [viewitemspnl]
                                                                     }, {type:'fade', direction:'left'});
                                 }
                                 }
                                 });

What code needs to change depends on display?

3

There are 3 best solutions below

0
On

Do the layout: 'fit' of the config object in which list is a item and remove the specified height and width.

0
On

put layout:'fit'..in that application it will work

6
On

I believe you should remove the width and height you have specified in list and add layout fit that should do it..

layout:'fit',