Extjs – vertical header in grid and locked columns

A while ago I wrote an article where I described how to create a plugin, which can flip header of Ext.panel.Grid vertically. I’ve been using this plugin for a couple of months in a company I work for, however in the last week it turned out that this extension does not work for grid with locked columns. After digging into Extjs source code I found out that when You use locked columns, the grid is created as a combination of two grids: normalGrid and lockedGrid. Therefore it is necessary to apply vertical-header plugin to these two grids separately. In order to do that, I improved this extension to detect if grid has locked columns or not. The main change is in init function which now looks that way

In the first step I check if columns are locked. The method for do that is pretty straightforward

Afterward I do create two instances of vertical-header plugin and initialize them with appropriate partial grid (lockedGrid or normalGrid). Entire code listing is presented below

vertical header
Source code for this post can be found here

Extjs – vertical header in grid and locked columns

3 thoughts on “Extjs – vertical header in grid and locked columns

  1. great post! exactly what i was looking for!
    one thing doesn't work as expected: in my grid, i want only the headers of the 'normal grid' to be vertical, the locked part's header should remain horizontal. so i created one instance of the plugin, and applied it only to the 'normal grid', but unfortunately if affected the entire grid.
    any suggestion?

  2. TPodolak says: 

    Change init function of plugin to

    init: function (grid) {
    var me = this;
    me.grid = grid;

    me.textMetric = new Ext.util.TextMetrics();

    if (me.isLocked()) {
    var normalGridPlugin = Ext.create('GeneralLearning.ux.VerticalHeader', Ext.apply(me.extraCfg, me.normalGridCfg)),
    lockedGridPlugin = Ext.create('GeneralLearning.ux.VerticalHeader', Ext.apply(me.extraCfg, me.lockedGridCfg));

    else {
    if (me.vertical)
    afterlayout: {
    scope: me,
    fn: me.handleAfterLayout

    and in Your grid create plugin this way

    It seems to work in my example

  3. Ext.onReady(function(){
    var data = [
    var store = new Ext.data.ArrayStore({
    fields: [
    { name: "state",type: "string"}
    data: data
    Cm = new Ext.grid.ColumnModel({
    defaults: {
    sortable: true
    { header: "State",dataIndex: "state" },
    var grid = new Ext.grid.GridPanel({
    autoHeight: true,
    ds : store,
    this is my code how can i do this here ? . i am not getting please help me. .!

Comments are closed.