2

我目前正在使用基于可编辑网格示例的 Extjs 4.1 网格组件。我想有一个与每个单元格相关联的链接,这样当我单击一个单元格时,它会弹出一个框来插入数据。但是,当点击链接时在页面上触发了垂直滚动。它将到达网格的第一行。这只发生在 IE 中(我使用的是版本 8)。但它在 chrome 中运行良好。请帮我解决 IE 8 的问题。

我的代码是:

var myGrid = {
    title:'Station',
    xtype:'dynamicgrid',
    forceFit:true,
    columnLines: true,
    selType: 'cellmodel',
    plugins: [cellEditing], 
    region:'center',
    autoHeight:true,
    autoWidth: 2100,
    store:myStore,
    features: [{
       ftype: 'grouping'
    }],
    dockedItems: [{
       store: myStore,
       dock: 'bottom',
       displayInfo: true
    }],
    listeners: {
        cellclick: function(iView, iCellEl, iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
               var fieldName = iView.getGridColumns()[iColIdx].dataIndex;
               var val = iRecord.get(fieldName);
               var a = val.split("<br>");
               if(a[0]==="NA"){
                  opennewwindow1(val);
               } else {
                  opennewwindow2(val);
               };
          }
     }    
 };
4

1 回答 1

0

尝试在 Click 事件中选择行

cellclick: function(iView, iCellEl, iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
iView.getStore().getSelectionModel().select(iRowIdx);
.
.
.
}
于 2014-01-31T08:18:23.510 回答