bit11
bit11

Reputation: 38

Extjs Grids with Locked columns, columns missing in grid.columns property

I have a ExtJs Grid with two left most columns locked, Now I have listener which cycles through all the columns of a grid and updates the header information.

var grid = this.grid
var columns = grid.columns;
for(var i=0;i<columns.length;i++)
  {
//do something with columns[i];
}

This used to work previously but now after locking columns it no longer works as expected.

Upvotes: 1

Views: 483

Answers (1)

Raghu
Raghu

Reputation: 244

Extjs Locked columns feature changes how the grid is stored in the Extjs Application tree.

Suppose you have a grid of 5 columns and you lock leftmost 2. Then Extjs internally divides your grid into two grids having 2 and 3 columns respectively. Therefore your code should be :

var grid = this.grid.items.items[0];
var columns = grid.columns;
for(var i=0;i<columns.length;i++)
  {
//do something with columns[i];
}

var grid = this.grid.items.items[1];
var columns = grid.columns;
for(var i=0;i<columns.length;i++)
  {
//do something with columns[i];
}

Upvotes: 1

Related Questions