在我基于 sencha 的应用程序中,我想让 ext.list 大小取决于设备屏幕。这是我使用过的代码。
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'});
}
}
});
哪些代码需要更改取决于显示?