admin管理员组

文章数量:1384604

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 one record?

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 one record?

Share Improve this question asked Oct 7, 2011 at 20:34 TowerTower 103k131 gold badges364 silver badges521 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

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);

本文标签: javascriptGet row HTML element based on grid39s recordmodel in ExtJSStack Overflow