简体   繁体   English

获取焦点所在的行(未选中)

[英]Get the focussed row (not the selected)

I have a grid, with a selection model that does allow the selection of a row only under certain conditions. 我有一个带有选择模型的网格,该模型仅在某些条件下才允许选择行。

When I click on a row, it gets focussed (it becomes darker gray). 当我单击一行时,它会被聚焦(它变成更深的灰色)。 I want to add a button, that acts on the currently focussed row. 我想添加一个按钮,该按钮作用于当前聚焦的行。

Since the selection is deactivated, I cannot use the normal way 由于选择已停用,因此我无法使用正常方式

grid.getSelectionModel().getSelection()

because there is no selection. 因为没有选择。 How can I access the focussed row ? 如何访问焦点所在的行?

Add this listener to your grid to get information about the focused row. 将此侦听器添加到网格中,以获取有关重点行的信息。

Ext.create('Ext.grid.Panel', {
    ...
    listeners: {
        afterrender: function(component){
            component.getSelectionModel().on({
                focuschange: function (view, oldFocused, newFocused, eOpts) {
                    console.log(newFocused);
                }
            });
        }
    }
});

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

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