extjs4 - Grid.reconfigure not working in extjs -


i have reset button grid supposed reset columns. code looks :

               function (response) {                     if (response == 'yes') {                          ext.state.manager.clear(grid.stateid);                          var cols = grid.initialconfig.columns                          grid.reconfigure(grid.getstore(), cols);                     }                 }); 

grid.reconfigure(..) supposed reset how table looks, nothing happens when run code above.

i noticed grid.initialconfig.columns undefined. why undefined? there kind of initial configuration needs set first?

(i notice when using constructor can define initialconfiguration. used initcomponent instead.)

try following:

initcomponent : function (){     var me = this;      // can expect extjs wan't change config      // sure clone array.      // (you may check this, because think don't need this)      me.columnscfg = me.columns.slice(0);      .... } 

and reconfigure

function (response) {     if (response == 'yes') {           // grid state saves ordering , visibility           ext.state.manager.clear(grid.stateid);           // store saves sorting (maybe filtering if it)           ext.state.manager.clear(grid.getstore().stateid);           grid.getstore().load(); // may call reload if want resend last load params            grid.reconfigure(grid.getstore(), grid.columnscfg);      } }); 

it looks bit weird doing columns. should stay configurations , not initialized columns. note while grid initialized override columns reference initialized columns. next point miss not grid saves sorting, store does. need reset store , reload it. must admit theory , don't tested it. in the real world cases faced store state disabled.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -