Get row HTML element based on grid's record/model in ExtJS
I have a grid in ExtJS where I am looping store items. I'd like to find a find to access the item's HTML element, but I'm having hard time finding the way to do this.
Simply put: how do you find the corresponding row HTML element for grid store's o开发者_运维知识库ne record?
Use its index in the store to retrieve the corresponding row, like so:
var htmlElement = grid.getView().getRow(index);
ExtJS 4.x: grid.getView().getNode(index)
getNode
can take an HTML ID (not very useful), an index, or a store record.
Just to add a little to it, if you've got a record that exists in a store that has a grid, but it came from say a separate ajax request, you might do
var objFromJSON: {
id: 134,
name: "Articulated Lorry"
}
var gridIndex = Ext.getStore("myStore").find("id", objFromJSON.id);
var htmlElement = grid.getView().getRow(gridIndex);
精彩评论