Reputation: 550
Suppose i have a sencha grid which has columns Name, Email, Address, Phone, City, State, Country
Now out this initially i am only displaying Name, Email, Address and Phone.
I have given the provision to display more columns, the pending ones, City, State and Country.
But the problem in that when ever i add a new column in the grid then it gets appended to the last...in my case suppose i add City then it gets appended after Phone...
But i want Phone to always remain the last column and if any other column is added then it should be prefixed before Phone column.
I am using sencha grid.
Kindly suggest
Upvotes: 2
Views: 6534
Reputation: 2496
Use headerCt for this. You can insert a new column to any position.
handler: function(btn) {
var grid = btn.up('gridpanel');
var column = Ext.create('Ext.grid.column.Column', {
text: 'Country',
dataIndex: 'country'
});
grid.headerCt.insert(
grid.columns.length - 1, // that's index column
column);
grid.getView().refresh();
}
Upvotes: 6