Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha touch 如何在sencha touch中更改列表项的字体大小和颜色_Sencha Touch_Extjs_Sencha Touch 2 - Fatal编程技术网

Sencha touch 如何在sencha touch中更改列表项的字体大小和颜色

Sencha touch 如何在sencha touch中更改列表项的字体大小和颜色,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,我有一个示例应用程序,其中我使用itemtpl将存储数据绑定到列表,当我从存储动态绑定数据到列表时,我几乎不知道如何更改前两个列表项的颜色和大小 这是我的示例代码: Ext.define('Sample.view.SearchResultView', { extend: 'Ext.Panel', requires: [ 'Ext.List', 'Ext.form.FieldSet', 'Ext.field.Text',

我有一个示例应用程序,其中我使用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>'

                                               )
              }
        ]
    },



}); 
Ext.define('Sample.view.SearchResultView'{
扩展:“Ext.Panel”,
要求:[
“外部列表”,
“Ext.form.FieldSet”,
“Ext.field.Text”,
“外部工具栏”,
“外部标题栏”
],
别名:“widget.searchresultpage”,
配置:{
可滚动:对,
项目:[
{
xtype:'列表',
布局:'适合',
身高:500,
标题:“搜索结果”,
商店:“MySearchStore”,
itemTpl:'{BlockNo}{ShortDescription}

' ) } ] }, });
您可以在
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>'
itemTpl:'{BlockNo}
{ShortDescription}

'
您需要在列表中添加
cls
属性,如:

cls:'myList'
然后将其添加到CSS文件中:

.myList .x-list-item:nth-child(1),
.myList .x-list-item:nth-child(2) {
  color: #CCC;
  font-size:14px;
}

希望这有帮助

谢谢你的回复,我的问题是如何更改列表中前两项的字体颜色和大小,而不是列表中的所有项目