mah*_*esh 2 extjs sencha-touch sencha-touch-2
我有一个示例应用程序,我使用itemtpl将商店数据绑定到列表,当我动态地将数据绑定到商店列表时,我几乎没有关于如何更改前两个列表项的颜色和大小的混淆.
这是我的示例代码:
Ext.define('Sample.view.SearchResultView', {
extend: 'Ext.Panel',
requires: [
'Ext.List',
'Ext.form.FieldSet',
'Ext.field.Text',
'Ext.Toolbar',
'Ext.TitleBar'
],
alias: "widget.searchresultpage",
config: {
scrollable: true,
items: [
{
xtype: 'list',
layout:'fit',
height:500,
title: 'Search Results',
store: 'MySearchStore',
itemTpl: '<table><td><tr height=10%>{BlockNo}</tr><tr height=90%><p>{ShortDescription}</p></tr></td></table>'
)
}
]
},
});
Run Code Online (Sandbox Code Playgroud)
您需要cls在列表中添加属性,例如:
cls:'myList'
Run Code Online (Sandbox Code Playgroud)
然后在CSS文件中添加:
.myList .x-list-item:nth-child(1),
.myList .x-list-item:nth-child(2) {
color: #CCC;
font-size:14px;
}
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助
你可以自己设置字体和颜色itemTpl.
itemTpl: '<table><td><tr height=10%><font size="12" color="#990000">{BlockNo}</font></tr>
<tr height=90%><p><font size="8" color="#990000">{ShortDescription}</font></p></tr></td>
</table>'
Run Code Online (Sandbox Code Playgroud)