在 ExtJS Grid 中选中复选框时如何专注于可编辑的文本字段? [英] How to focus on editable textfield when checkbox is checked in ExtJS Grid?

查看:10
本文介绍了在 ExtJS Grid 中选中复选框时如何专注于可编辑的文本字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 checkcolumn 和 celledit 创建一个网格.我有 3 列 1 用于复选框,其他是可编辑的文本字段,第三列是产品名称,使用 celledit 编辑价格.

I am creating a grid with checkcolumn and celledit. I have 3 columns 1 is for checkboxes and other is editable text field and 3rd is the productname, using celledit to edit the price.

当我选中记录上的复选框时,焦点应该在该特定记录的文本字段上.

When I will check a checkbox on a record the focus should be on the textfield for that particular record.

这是代码示例:

Ext.define('MyApp.view.EntryPage',
{
extend : 'Ext.grid.Panel',
alias : 'widget.entryPage',
title : 'Product Price Entry',
store : 'ProductStore',
loadMask: true,

plugins: [Ext.create('Ext.grid.plugin.CellEditing', {clicksToEdit: 1})],

initComponent:function(){

    var me = this;
    this.selModel = {xtype:'cellmodel'},

    this.columns = {
                defaults:{sortable : true,hideable : true,menuDisabled : true,align : 'left',style : 'text-align:left'},
                items:[
                          {

                              xtype: 'checkcolumn',
                              header: 'Check Me',
                              dataIndex : 'active',
                              listeners:{

                              checkchange : function( CheckColumn, rowIndex, checked, eOpts ){
                              // Select the textfield

                              }}
                          },
                          {
                               text : 'Price',
                               flex:0.75,
                               sortable : false,
                               hideable : false,
                               dataIndex : 'unitprice',
                               editor: 'textfield'
                          },
                          {
                               text : 'Product Name',
                               flex:2,
                               dataIndex : 'pname'
                          }
                    ]};

        //this.features = [];
        this.callParent(arguments);

} 
});

推荐答案

在listener的帮助下(使用edit事件),如果已经勾选,则获取record的引用并应用focus()方法.

With the help of listener(use edit event), if it has been checked, get the reference of record and apply focus() method.

请参阅以下链接以供参考.

Refer below link for reference.

http:///docs.sencha.com/extjs/4.0.7/#!/api/Ext.grid.plugin.CellEditing-event-edit

查看以上链接中的编辑事件.

see the edit event in the above link.

谢谢

这篇关于在 ExtJS Grid 中选中复选框时如何专注于可编辑的文本字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆