日期:2014-05-16  浏览次数:20568 次

ext.tree.panel 通过celldbClick 得到column
celldblclick:function(_this, td, cellIndex, _record, tr, rowIndex, e, eOpts){
                    var record=_this.getGridColumns()[cellIndex];
                    if(record.text=='时间'){
                        Ext.Msg.confirm('提示', '是否录入当前时间的数据?', function(btn) {
                            if (btn === 'yes') {
                                var dt = new Date();
                                record.setText(Ext.Date.format(dt, 'H:i:s'));
                                record.setEditor( {xtype:'textfield'} );
                            }
                        });
                    }
                }

EXTJS 4.2以后改了treepanel为tree.panel,里面没有了getColumnModel()方法。所以,当使用tree.panel的时候,很难通过单击或者双击cell来得到column对象。找了好久,终于好了。通过
   treepanel.getView().getGridColumns()[cellIndex](注:方框后也可以是列的dataindex)