Reputation: 116
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.
any idea how to manage this issue?
Upvotes: 0
Views: 36
Reputation: 3850
you have to use itemTpl property of the Ext.dataview.DataView class, see config: itemTpl Basically this is an expression of Ext.XTemplate
In your case imagine you defined in model field unread, then you can write something like:
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.
function markAsRead(newsModel) {
newsModel.set('unread', false);
}
Upvotes: 1