how to find column index using dataIndex Extjs 4

Hmxa Mughal picture Hmxa Mughal · Dec 6, 2012 · Viewed 25.6k times · Source

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 is ir possible that i can find the column index of the grid by the dataIndex of the column or the header name of that column.

Answer

Murrah picture Murrah · Mar 3, 2013

You can use the component query:

var fname = grid.down('[dataIndex=firstname]');

It took a while to work that out - there doesnt seem to be an example in the docs. ;-)