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?
Do the
layout: 'fit'
of the config object in which list is a item and remove the specified height and width.