View Full Version : Field order & positioning in grids

25 Jun 2012, 5:06 AM
i am new to sencha and i haven't found a solution to my problem,

is it possibile to establish a "position" for a specific grid column ?

I mean if i have a grid with the following columns:

Name | Surname | Company

I would like to move Company at start, without moving my lines up or down,

simply writing a "position" attribute, like :

{ header: 'name' , dataIndex: 'name', position: 2 }
{ header: 'surname' , dataIndex: 'surname', position: 3 }
{ header: 'company' , dataIndex: 'company', ---> POSITION: 1 }

to obtain something like this:

Company | Name | Surname

I know i can do it simply moving the lines of my javascript code, but in many case if i alter my DB table stucture, i will need to re-code many part of my project.

Thank you

25 Jun 2012, 11:11 AM
You can use grid.reconfigure to change your column order, fields, etc.


25 Jun 2012, 12:15 PM
Thank you very much @scottmartin, i'll give it a try. The function is not well documented but google is my friend :D

25 Jun 2012, 12:20 PM
You basically define your 'alternate' store/columns and give it a call. You can build you columns object.