PDA

View Full Version : gridPanel.applyState( coulmnData ) not working



Vikram
22 Mar 2016, 7:55 AM
Hello there,

I am using EXT JS 4.2 and using below code to display the column order as user saved it.


gridPanel.applyState( coulmnData )



Sometime order of the columns not showing as user saved it even stateId is correct in table.
any idea how to fix this ?

Regards
vik

Gary Schlosberg
22 Mar 2016, 3:28 PM
Which specific version of Ext JS are you running? Have you seen this example?
http://docs.sencha.com/extjs/4.1.1/#!/example/grid/array-grid.html

Did you set stateful (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.Panel-cfg-stateful) to true in your grid config?

Vikram
22 Mar 2016, 11:38 PM
Hello Gary,
thanks for reply, I have already tried 'statful:true' but not success.
I m using "EXT JSVersion: "421883", version: "4.2.1.883"

As i have already mentioned that i am getting columns order from database table.
see if you can provide me more solutions to fix this issue.



gridPanel = Ext.create('Ext.grid.Panel', {
header: false,
anchor: '100% 100%',
columnLines: true,
plugins: [{ ptype: 'bufferedrenderer' }],
store: store,
loadMask: true,
stateful:true,
},....

and i have added unique stateId in each column

stateId: 'statePosting',

thanks & regards
vik

Vikram
5 May 2016, 3:14 AM
Hello Gary, Any updates on this ??

SurenderBhyan1
11 May 2016, 4:10 PM
Facing the same issue in Ext JS 4.2.1.


Steps:
1. Load the display
2. hide/unhide OR change some columns order by moving them.
3. Close display ( Here I am saving displayState in Db on display close.)
4. Load display again and used below code before render to apply the state saved in DB.


myGrid.applyState(colDataWithState);


-- colDataWithState is coming from DataBase.


Interesting this is that if I put console like
console.log(colDataWithState)


myGrid.applyState(colDataWithState);


Here console show me the exact order that i saved in DB, but after applyState, column ordered is not as per view saved.


I am using the stateful: true and unique stateId fopr each column, Also grid have some Action column too.

Any help will be appricated :)

SurenderBhyan1
11 May 2016, 4:32 PM
Might be a bug in 4.2.1

https://www.sencha.com/forum/showthread.php?272661-Grid.applyState-moveColumn-bug-when-some-columns-are-hidden