简体   繁体   English

Sencha Touch 2.4,突出显示列表中的新记录

[英]Sencha Touch 2.4, highlighting new record in the list

I would like to highlight new record(s), let say all new news(s) and unread from last 3 days to be highlighted as new in the list and when user clicks on the record and read the detail, change to unhighlighted. 我想突出显示新记录,比方说过去三天的所有新新闻和未读内容在列表中突出显示为新内容,并且当用户单击记录并阅读详细信息时,更改为未突出显示。

my json, delivers delivers the date and time of the each recored. 我的json,传递了每个重新记录的日期和时间。

any idea how to manage this issue? 任何想法如何解决这个问题?

you have to use itemTpl property of the Ext.dataview.DataView class, see config: itemTpl Basically this is an expression of Ext.XTemplate 您必须使用Ext.dataview.DataView类的itemTpl属性,请参阅config:itemTpl基本上,这是Ext.XTemplate的表达式

In your case imagine you defined in model field unread , then you can write something like: 在您的情况下,假设您在模型字段中定义了unread ,那么您可以编写如下内容:

 config: {
        itemTpl: [
            '<div',
            '<tpl if="unread"> class="my-unread-css"</tpl>',
            '>',
            '{newsText}',
            '<div>',
        ]
 }

Then somewhere in controller call of the function will remove css class from the list item. 然后,该函数的控制器调用中的某处将从列表项中删除css类。

 function markAsRead(newsModel) {
      newsModel.set('unread', false);
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM