簡體   English   中英

如何將Extjs.grid.CheckColumn設置為只讀禁用?

[英]How to set Extjs.grid.CheckColumn to disabled for read only?

我有一個帶有檢查列的網格,檢查列讀取了我的數據,但是我無法設置它,我想知道如何以簡單的方式設置它。 我希望我的檢查列僅在我的網格數據中變為視圖,如何設置它? 下面是我的示例代碼:

var chkColH = new Ext.grid.CheckColumn({
    header: ' H',
    dataIndex: 'testing',
    resizable:false,
    disabled :true, //***I wan to disabled this check column in my grid for view only
    width: 25
});

colModel=new Ext.grid.ColumnModel([
    chkColH
]);


        xtype:'editorgrid',
        id:'theGrid',
        stripeRows:true,
        store:gridStore,
        colModel:colModel,
        trackMouseOver:false,
        columnLines:true,
        enableColumnMove:false,
        enableHdMenu:false,
        frame:true,
        disableSelection:true,
        plugins: [chkColH],
        sm:chkSM

var chkColH = new Ext.grid.CheckColumn({ header: 'Rerun', dataIndex: 'rerun', resizable:false, width: 25, disabled : true, disabledCls : 'x-item-enabled' });

將此添加到您的代碼庫中,並使用“ readonlycheckcolumn” xtype而不是“ checkcolumn”(已在Ext 4.2中進行了測試):

Ext.define('Ext.grid.column.ReadOnlyCheckColumn', {
    extend: 'Ext.grid.column.CheckColumn',
    alias: 'widget.readonlycheckcolumn',
    requires: ['Ext.grid.column.CheckColumn'],
    listeners: { beforecheckchange: function () { return false; } }
});

您可以覆蓋onmousedown事件做沒有什么CheckColumn:

var chkColH = new Ext.grid.CheckColumn({
    header: ' H',
    dataIndex: 'testing',
    resizable:false,
    width: 25,
    onMouseDown : function(e, t){}
});

在checkcolumn配置中添加以下事件:

processEvent: function () { return false; }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM