PDA

View Full Version : Extjs 4.2.x Grid Reconfigure: Reusing Grid's Columns (remove some)



arnoldvillasanta
11 Jun 2014, 10:46 AM
Hi,

The objective is to Reconfigure a Grid by reusing the existing Grid's column (40) but deleting 5 columns from that (leaving 35 fields).

Here is my code so far (codes with ???? are undone)


//Reconfigure the Result Grid
var newStore = Ext.getStore('Overall_Information_2_External');
var theGrid = Ext.getCmp('overallInformationPanel');
var columns = theGrid.getView().headerCt.getGridColumns();
// ???? needs to process columns as this returns [object Object], [object Object]........
// ???? delete columns by index, or by key
var newColumns = // 40 columns - 5 columns
theGrid.reconfigure(newStore, newColumns);




I need help to fill up the ?????? based on the following scenario:
I don't want to recreate the definition of each column. theGrid's original columns have their own lock, hideable, hidden, groupable, sortable, movable, width, etc. configurations already defined (in SA3).
There are row and cell actions defined in theGrid. The cells with actions are NOT included in the 5 columns to be removed.
There is remote and local filtering in theGrid.
GroupingFeature is used in theGrid.
No PagingToolbar in theGrid.
There is a ClientSide JS to export theGrid into Excel.
These features need to be consistent on both original and reconfigured Grid.

Thanks in advance... :)

k_cire0426
26 Aug 2014, 11:13 PM
Were you able to resolve your issue here? We have the same case, but my main purpose is to remove editor. I tried to remove it using setEditor(null) but I didn't work.

arnoldvillasanta
27 Aug 2014, 12:36 AM
Not received any help yet on this one.

I thought if this is not possible in Sencha, then might consider adding this functionality in future release.

In my case, I removed the 5 'unwanted' columns in the excel exporter JS by adding a boolean parameter... which is good only for 2 scenarios. Better pass an array of header names if there will be more than 2 grids templates to export as excel files.

k_cire0426
27 Aug 2014, 12:43 AM
My primary purpose of removing the editor is to skip that column when user pressed the tab. I just resolved it by returning 'false' to 'beforeedit' event of the celledit plugin. Will it not work for you if you just get the 'columns' property of the grid and iterate on that using Ext.Array.each? This will probably help you remove some column in the array but I'm not sure if that will work in 'reconfigure' of grid.