PDA

View Full Version : Reflect swap of columns of the grid in excel sheet



wasima
11 Mar 2012, 9:40 PM
I have a grid, i read the contents of the grid to export it to excel sheet ..i read the grid(store) data as grid..getStore().each(function(rec){......} now if i make some modifications from the grid like sorting it is getting reflected in excel sheet ...but when i swap the columns of the grid from the UI , this change in the grid is not getting reflected in my excel sheet .....how do i solve this issue...?

vietits
11 Mar 2012, 10:52 PM
Your store does not reflect the order of fields shown on grid. To get out the fields with their order on the grid you could use the following code:


var view = <grid>.getView();
var headerCt = view.headerCt;
var columns = headerCt.items;
var fields = [];
columns.each(function(column){
if(column.dataIndex) fields.push(column.dataIndex);
})
....