简体   繁体   English

ExtJS 3:如何使用 fireEvent 在 Ext.grid.GridView 中选择具有类 x-grid3-cell-inner 对象的行

[英]ExtJS 3: how to select row in Ext.grid.GridView having object of class x-grid3-cell-inner using fireEvent

I have an object of Ext.grid.GridView class with rows in it.我有一个Ext.grid.GridView类的对象,其中包含行。 Rows have class x-grid3-cell-inner.行具有类 x-grid3-cell-inner。 I want to select row in GridView using fireEvent methods.我想使用 fireEvent 方法在 GridView 中选择行。 So, for example, I write code (I have id of first cell):因此,例如,我编写代码(我有第一个单元格的 id):

var e = document.createEventObject(); 
e.button = 0; 
var o = document.getElementById('id'); 
o.fireEvent('OnMouseDown', e);

But nothing happens.但什么也没有发生。 I tried to do that for button and it works, but it doesn't work for row in Ext.grid.GridView.我试图对按钮执行此操作并且它有效,但它不适用于 Ext.grid.GridView 中的行。 Can somebody tell me how to select row in that ExtJS Grid using DOM events?有人能告诉我如何使用 DOM 事件在 ExtJS Grid 中选择行吗? PS I cannot use Ext object to work with grid. PS 我不能使用 Ext 对象来处理网格。

I can't see a listener for onmousedown in the code.我在代码中看不到onmousedown的侦听器。 I can see one for click .我可以看到一个click You could try that.你可以试试。

Why can't you use the Ext object, however?但是,为什么不能使用 Ext 对象呢? Seems like you could find the id of the cell, go up until you find the grid component's id, Ext.getCmp to get a reference to the grid component and then use the RowSelectionModel.似乎您可以找到单元格的 id,直到找到网格组件的 id, Ext.getCmp才能获得对网格组件的引用,然后使用 RowSelectionModel。

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

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