Extjs4 在gridpanel中查找行id

Extjs4 在gridpanel中查找行id,extjs4,Extjs4,如何在一个gridpanel中找到行索引,该gridpanel的列中有组合框,用于通过和ajax代理更新存储/数据库?我正在使用Ext.grid.plugin.CellEditing。这是我的密码。谢谢你看 Ext.Loader.setConfig{ 已启用:true }; setPath'Ext.ux','/extjs4/examples/ux'; 外部要求[ “Ext.layout.container.Fit”, “Ext.grid.*”, “Ext.data.*”, “Ext.util.*

如何在一个gridpanel中找到行索引,该gridpanel的列中有组合框,用于通过和ajax代理更新存储/数据库?我正在使用Ext.grid.plugin.CellEditing。这是我的密码。谢谢你看

Ext.Loader.setConfig{ 已启用:true }; setPath'Ext.ux','/extjs4/examples/ux'; 外部要求[ “Ext.layout.container.Fit”, “Ext.grid.*”, “Ext.data.*”, “Ext.util.*”, “Ext.panel.*”, “Ext.selection.CellModel”, “Ext.state.*”, “Ext.form.*”, “Ext.ux.CheckColumn” ]; Ext.define'Ext.app.HirePlanGrid'{ 扩展:“Ext.panel.panel”, 别名:“widget.hirePlangrid” ,hireplanstoreId:“hireplanstore” ,hiremonthstoreId:'hiremonthstore' ,renderMonth:函数值,p,记录{ var fkStore=Ext.getStorethis.up'hirePlangrid'.hiremonthstoreId; var rec=fkStore.findRecordMONTH\u ID,值; //返回rec.GET缩写的月份; } ,initComponent:函数{ this.editing=Ext.create'Ext.grid.plugin.CellEditing'{ 单击编辑:2 }; var objMonthStore=Ext.getStorethis.hiremonthstoreId; objMonthStore.load; var objStore=Ext.getStorethis.hireplanstoreId; objStore.setProxy{ 键入:“ajax”, url:'hireplan.cfc?方法=getEmployees' }; objStore.load; var onDeleteClick=函数字段、值、选项{ //var objPanel=this.down'gridpanel'; var selection=Ext.getCmp'grid'.getSelectionModel.getSelection; 警报选择; //var selection=getView.getSelectionModel.getSelection[r]; 如果值{ 警戒值; objStore.removevalue; objStore.sync; } }; var onUpdateClick=函数字段、值、选项{ 警报'field='+field+'value='+value+'options='+options; objStore.updateobjStore.getAtvalue; 同步; }; 外接applythis{ 布局:“适合”, 宽度:800, //身高:1500, 项目:[{ xtype:'网格', id:'gridgrid', //身高:300, 商店:objStore, selModel:{selType:'cellmodel'}, selType:“行模型”, 插件:[this.editing], //插件:[cellEditing], 专栏:没错, 视图配置:{stripeRows:true}, //loadMask:是的, disableSelection:正确, 听众:{ selectionchange:functionselModel,已选择{ var selection=Ext.getCmp'gridgrid'.getSelectionModel.getSelection; } }, 栏目:[ {头:'rowid',hidden:true,数据索引:'rowid'}, { 标题:“指示器”, id:'chkcolumn', xtype:“检查列”, 数据索引:'CHK_COL', 编辑:{ xtype:'复选框', cls:'x-grid-checkheader-editor' }, 监听器:checkchange:functioncolumn、recordIndex、checked { 警报'checked rindex='+记录索引; onDeleteClickcolumn,recordIndex,选中; //或者发送请求 } } }, { id:“employeeid”, 标题:“employeeid”, 宽度:80, 隐藏:假, 可排序:是的, 数据索引:“EMPLOYEEID”, 弹性:1 }, { id:'国家编号', 标题:“国家编号”, 宽度:80, 可排序:是的, 数据索引:“国家编号”, 弹性:1 }, { id:“MARITALSTATUS”, 标题:“MARITALSTATUS”, 宽度:80, 可排序:是的, 数据索引:“MARITALSTATUS”, 弹性:1 }, { id:“潜在内购KV”, 标题:“内包潜力”, 宽度:30, 可排序:是的, dataIndex:“潜在的内部外包”, 弹性:1, 编辑:{ id:'这个组合', xtype:“组合框”, 是的, 触发动作:“全部”, selectOnTab:对, 商店:[ ['1','是'], ['0','否'] ], lazyRender:是的, listClass:'x-combo-list-small', 侦听器:{“选择”:函数{ var selval=Ext.getCmpthiscombo.getValue; //var recval=Ext.getCmpgrid.getValue; //var selection=getView.getSelectionModel.getSelection[r] alertselval+“”+rowIdx; //onUpdate ClickEditor,rowIdx,值; } }, } }, { id:'缩写的月份', 标题:“缩写的月份”, 宽度:80, 可排序:是的, dataIndex:'缩写的月份', 弹性:1, 渲染器:this.renderMonth, 字段:{ xtype:“组合框”, 存储:Ext.getStorethis.hiremonthstoreId, 是的, lazyRender:是的, queryMode:'本地', displayField:'缩写的月份', valueField:“月份ID”, listClass:'x-combo-list-small' } }, { id:‘工薪阶层’, 标题:“SALARIEDFLAG”, 宽度:80, 可排序:是的, dataIndex:“工薪阶层”, 弹性:1 }], 特点:[{ F类型:“rowbody” }] }] }; 这是一个参数; //this.getSelectionModel.on'selectionchange',this.onSelectChange,this; },//初始化组件 getSelectedRowIndex:函数{ var r,s; r=this.getView.getSelectionModel.getSelection; s=this.getStore; 返回s.indexOfr[0]; }, onSelectChange:功能选择模型、选项{ 此.down'delete'.setDisabledselections.length==0; }, 同步:函数{ objStore.sync; }, 视图配置:{}, };
我在另一篇文章中读到,我需要做的是向this.cellediting添加一个侦听器,并使用“beforeedit”事件查找行索引,然后设置为变量:

    var  rIdx = '';
    var  cIdx = '';     
    this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit: 1,
    listeners: {
    'beforeedit': function(e){
    var me = this;
    var allowed = !!me.isEditAllowed;
    if (!me.isEditAllowed) 
    Ext.Msg.confirm('confirm', 'Are you sure you want edit?', function(btn){
                        if (btn !== 'yes') 
                            return;
                        me.isEditAllowed = true;
                        me.startEditByPosition({
                            row: e.rowIdx,
                            column: e.colIdx
                        });         
                    });
                 rIdx = e.rowIdx;
                 cIdx = e.colIdx;
                 alert('rIdx= ' + rIdx + ' cIdx = ' + cIdx);
                return allowed;
            },
            'edit': function(e){
                this.isEditAllowed = true;
    }
    }
    });

也许分享你的代码是件好事,这样我们可以为你解答。无论如何,您始终可以将事件挂钩添加到CellEditing的编辑事件。它在EventObject中具有rowIdx属性。但所有这些都取决于您拥有的代码。这只是可能的选项之一。在尝试格式化代码时,我发现大括号不匹配。除了这一行这样的错误之外:监听器:checkchange:functioncolumn,recordIndex,checked。请先清理你的代码。信不信由你,监听器:checkchange:functioncolumn,recordIndex,checked实际上工作得很好。我会看看我能对牙套做些什么…谢谢你看!