Well in ExtJS 3 i used the following code:
grid.getColumnModel().findColumnIndex(\"Tasks\")
I tried finding it on the api docs, but no luck...so how
I guess you should find index by iterating through grid.columns
array and comparing dataIndex
property of each column.
Example:
var findColumnIndex = function(columns, dataIndex) {
var index;
for (index = 0; index < columns.length; ++index) {
if (columns[index].dataIndex == dataIndex) { break; }
}
return index == columns.length ? -1 : index;
}
console.log(findColumnIndex(grid.columns, 'Task'));
console.log(findColumnIndex(grid.columns, 'Something'));