PDA

View Full Version : Field order & positioning in grids



sapanto
25 Jun 2012, 5:06 AM
Hello,
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

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

Scott.

sapanto
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

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

Scott.