简体   繁体   English

根据ExtJS中网格的记录/模型获取行HTML元素

[英]Get row HTML element based on grid's record/model in ExtJS

I have a grid in ExtJS where I am looping store items. 我在ExtJS中有一个网格来循环存储项目。 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. 我想找到一个访问该项目的HTML元素的内容,但是我很难找到这样做的方法。

Simply put: how do you find the corresponding row HTML element for grid store's one record? 简而言之:如何找到网格存储的一条记录的对应行HTML元素?

在存储中使用其索引来检索相应的行,如下所示:

var htmlElement = grid.getView().getRow(index);

ExtJS 4.x: grid.getView().getNode(index) ExtJS 4.x: grid.getView().getNode(index)

getNode can take an HTML ID (not very useful), an index, or a store record. getNode可以使用HTML ID(不是很有用),索引或商店记录。

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 只是添加一点,如果您有一个存储在具有网格的商店中的记录,但是它来自一个单独的ajax请求,那么您可以这样做

var objFromJSON: {
    id: 134,
    name: "Articulated Lorry"
}

var gridIndex = Ext.getStore("myStore").find("id", objFromJSON.id);
var htmlElement = grid.getView().getRow(gridIndex);

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

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