extjs中如何选中grid中的行,并设置该行不可编辑

extjs中如何选中grid中的行,并设置该行不可编辑,第1张

Ext.create('Ext.grid.Panel', {

  title: 'Simpsons',

  store: Ext.data.StoreManager.lookup('simpsonsStore'),

  columns: [

      { text: 'Name',  dataIndex: 'name' },

      { text: 'Email', dataIndex: 'email', flex: 1 },

      { text: 'Phone', dataIndex: 'phone' }

  ],

  listeners:{

      beforeedit:function(editor, e, eOpts){

          //return false//不可编辑

      return true//可编辑

      }

  },

  height: 200,

  width: 400,

  renderTo: Ext.getBody()

})

if (!Ext.grid.GridView.prototype.templates) {

Ext.grid.GridView.prototype.templates = {}

}

Ext.grid.GridView.prototype.templates.cell = new Ext.Template(

'<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable {css}" style="{style}" tabIndex="0" {cellAttr}>',

'<div class="x-grid3-cell-inner x-grid3-col-{id}" {attr}>{value}</div>',

'</td>'

)

添加如上代码,就可以选中


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11621821.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存