Extjs Grid- disable some checkbox on special row -


i have simple gridpanel column using xtype:checkcolumn

ext.define('ext.abc.grid', {      extend: 'ext.grid.panel',           columns: [         {             text: 'id', dataindex: 'id'         },              { text: 'status', dataindex: 'abc',            xtype: 'checkcolumn',              /*viewconfig: {                  getclass: function(value, metadata, record){                  })             },*/             listeners:{                 beforecheckchange: function(column, row, checked, opts){                  },                 checkchange:function(cc,ix,ischecked){                 }             }         }     ] }); 

i want disable checkboxes on special row column id. possible? how can that? thanks.

i took code of ext.grid.column.checkcolumn, , think less intrusive way achieve want to:

  1. use tweaked model prevent modification on desired condition.

  2. override column renderer add disabled class record not checkable.

example:

// using anonymous model class show can this, // if don't need define application-wide model var model = ext.define(null, {     extend: 'ext.data.model'      ,fields: ['id', 'status', 'checkable']      // example data         ,proxy: {         type: 'memory'         ,reader: 'array'         ,data: [             [1, true, true]             ,[2, true, false]             ,[3, false, true]             ,[4, false, false]         ]     }      // 1. prevent modification on conditions         ,set: function(field, value) {         if (field === 'status' && !this.get('checkable')) {             return null;         } else {             return this.callparent(arguments);         }     } });  ext.widget('grid', {     renderto: ext.getbody()     ,height: 200     ,store: {         model: model         ,autoload: true     }     ,columns: [{         text: 'id'         ,dataindex: 'id'     },{          text: 'status'         ,dataindex: 'status'         ,xtype: 'checkcolumn'          // 2. custom renderer reflect "checkability"                 ,renderer: function(value, meta, record) {             var cssprefix = ext.basecssprefix,                 cls = [cssprefix + 'grid-checkcolumn'];              if (                 this.disabled                  // added condition disabledcls                 || !record.get('checkable')             ) {                 meta.tdcls += ' ' + this.disabledcls;             }             if (value) {                 cls.push(cssprefix + 'grid-checkcolumn-checked');             }             return '<img class="' + cls.join(' ') + '" src="' + ext.blank_image_url + '"/>';         }     },{         text: 'modifiable'         ,dataindex: 'checkable'         ,xtype: 'booleancolumn'     }] }); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -