PDA

View Full Version : [CLOSED] Command Column



RCM
Aug 22, 2012, 5:38 AM
Hi guys,

what would be the equivalent to the code below, works in version 1 but not in 2.0. not able to get column model.



var prepare = function (grid, toolbar, rowIndex, record) {
var firstButton = toolbar.items.get(0),
cm = grid.getColumnModel(),
width = cm.getColumnWidth(cm.getIndexById("CommandColumn1"));

firstButton.setWidth(width);
};

Daniil
Aug 22, 2012, 6:38 AM
Hi,

The ColumModel became just the Columns collection, an Ext.grid.header.Container instance.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.header.Container (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.grid.header.Container)

Now the Columns are the controls. I mean that you can access them as common controls via client ids.

The following should work. The "App" is the default Namespace. If you changed it, you should changed it in the code below as well.

Example

var prepare = function (grid, toolbar, rowIndex, record) {
var firstButton = toolbar.items.get(0);

firstButton.setWidth(App.CommandColumn1.getWidth() );
};

RCM
Aug 23, 2012, 4:44 AM
Hi,

Please mark as closed.