View Full Version : How to get the Ext.grid.Column or Ext.grid.ColumnModel owner?

13 Oct 2009, 6:49 AM
Hi all,
my problem is how to get programmatically the owner (Grid) having a Ext.grid.GridColumn or Ext.grid.ColumnModel.

Note that I can't put an id on Grid and then use Ext.getCmp.....


13 Oct 2009, 7:08 AM
ColumnModel (i think) has a grid reference.

13 Oct 2009, 7:12 AM
My first question would be why can't you use Ext.getCmp()? Apart from that you can build the grid as a variable or property of your object and access it that way.

var cm = new Ext.grid.ColumnModel({

var grid = new Ext.grid.GridPanel({
colModel: cm

13 Oct 2009, 7:18 AM
I just confirmed that the view does have a local reference to the grid it's associated with.

13 Oct 2009, 7:21 AM
thanks for your answer.

To zhegwood
Yes, I have already do so, but why not ExtJS has that link? In Ext.Panel, for example, is available the property ownerCt.

To Garcia
I have look for that but I have not find it.
Could u help me, please?

13 Oct 2009, 7:23 AM
I don't understand what the difficulty is! GridPanel.view.grid

13 Oct 2009, 7:37 AM
Excuse, me Garcia, probably I have not explain well my problem.

I have a CustomColumnModel that extends Ext.grid.ColumnModel

ABS.Ext.grid.CustomColumnModel = Ext.extend(Ext.grid.ColumnModel, {
isCellEditable: function (aCol, aRow) {
var vReadOnlyMode = this.config[aCol]['readonlymode'];
if (vReadOnlyMode == ReadOnlyMode.ON_EDIT_READONLY) {
var vRecord = this['ownerGrid'].getStore().getAt(aRow);
if (vRecord.get('_NEW_ROW')) {
return true;
return vReadOnlyMode == ReadOnlyMode.NEVER_READONLY;

My problem is that I have put the property 'ownerGrid' in my CustomColumnModel
because in isCellEditable method I need to read some grid data value to enable ditor or not.

var vRecord = this['ownerGrid'].getStore().getAt(aRow);

Is possible to change the statemnt above using ExtJS and not a my custom property to get the store?


13 Oct 2009, 7:44 AM
Ack - i'm thinking 'view' not column model. my apologies. i'll get back to you

13 Oct 2009, 7:53 AM
Try the following override:

(function() {

var initDataFn = Ext.grid.GridView.prototype.initData;

Ext.override(Ext.grid.GridView, {
initData : function() {
initDataFn.apply(this, arguments);

this.cm.grid = this.grid;


This way your column model will have a local grid reference.