admin管理员组文章数量:1327744
Any idea how to highlight newly inserted row?
i tried to use store's add event and it gives me the record and record index which last inserted.
but how can i reference it to highlight the grid row?
this is the store.
Ext.create('Ext.data.Store', {
model : 'invoice_model',
storeId : 'invoice_store',
proxy : {
type: 'memory'
},
listeners : {
add : function(s, r, i){
console.log(r)
}
}
});
Regards
Any idea how to highlight newly inserted row?
i tried to use store's add event and it gives me the record and record index which last inserted.
but how can i reference it to highlight the grid row?
this is the store.
Ext.create('Ext.data.Store', {
model : 'invoice_model',
storeId : 'invoice_store',
proxy : {
type: 'memory'
},
listeners : {
add : function(s, r, i){
console.log(r)
}
}
});
Regards
Share Improve this question asked Sep 11, 2011 at 16:03 Gihan LasitaGihan Lasita 3,05314 gold badges49 silver badges66 bronze badges2 Answers
Reset to default 5Assuming "i" is the index of the record on the grid (hence, index of the row in the grid):
Ext.fly(myGrid.getView().getNode(i)).highlight("highlight color", {
attr: 'color', duration: 5000
});
However, if the inserted record is always going to be on the first row, you can just specify the first after a record is added :
Ext.fly(myGrid.getView().getNode(0)).highlight("highlight color",{
attr: 'color', duration: 5000
});
To Highlight the background color of the row, you can add a highlight class to the newly inserted row:
CSS :
.myHighlight{
background : your-highlight-color
}
JS
Ext.fly(myGrid.getView().getNode(0)).addCls("myHighlight");
and then remove it once your done highlighting :
Ext.fly(grid.getView().getNode(0)).removeCls("myHighlight");
In your add function, try Ext.fly(myGrid.getView().getNode(r.getId())).highlight("0000ff", { attr: 'color', duration: 2 });
Change highlight config to your preference
EDIT
Store's add event gives us an array of records that were added. If you want to highlight all of them, iterate over the array and call the above snippet for each record in the array. if you want to highlight particular one, (first or last maybe), get it from the array and call the above snippet. In the above snippet, r refers to a particular record.
本文标签: javascriptHow to highlight the Extjs grid newly inserted rowStack Overflow
版权声明:本文标题:javascript - How to highlight the Extjs grid newly inserted row? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742230478a2437130.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论