1

I have developped a method to change dynamically grid header menus. I remove columns and use configuration to add others. But an error occurs if order is changed for a column when my method is called.

Here is the code of columnSwitch method : (The important line is in the try catch block)

   // Save actual config
   var wasDefault = ox.scheduler.config.managedColumn === ox.scheduler.config.defaultColumn;
   var oldConfig  = buildColumnConfig(getColumnsConfig());

   ox.scheduler.config.managedColumn = switchToIndex;
   var isDefault    = ox.scheduler.config.managedColumn === ox.scheduler.config.defaultColumn;
   var columns      = getColumnsConfig();
   var columnConfig = buildColumnConfig(columns);

   // Reset columns with old config
   oldConfig.forEach(function(config) {
      if (config.itemId !== 'ActionColumn' || wasDefault) {
         _self.lockedGrid.headerCt.remove(config.itemId);
      }
   });

   // Add new ones
   columnConfig.forEach(function(config) {
      // Disable actions column for not default
      if (config.itemId !== 'ActionColumn' || isDefault) {
         try {
            console.log(config.itemId);
            _self.lockedGrid.headerCt.add(config);
         } catch (e) {
            console.log(e);
         }
      }
   });

   _self.lockedGrid.reconfigure();

   _self.updateLoadParameters();
   _self.reload();

And the console error stack :

ext-all-debug.js?v=6.6.0.258:256492 Uncaught TypeError: Cannot read property 'getAnimatePolicy' of undefined
    at constructor.initAnimation (ext-all-debug.js?v=6.6.0.258:256492)
    at constructor.invalidate (ext-all-debug.js?v=6.6.0.258:258522)
    at constructor.flushInvalidates (ext-all-debug.js?v=6.6.0.258:258319)
    at constructor.run (ext-all-debug.js?v=6.6.0.258:258853)
    at Function.flushLayouts (ext-all-debug.js?v=6.6.0.258:72198)
    at Function.resumeLayouts (ext-all-debug.js?v=6.6.0.258:72213)
    at Object.Ext.resumeLayouts (ext-all-debug.js?v=6.6.0.258:78184)
    at constructor.syncLockedWidth (ext-all-debug.js?v=6.6.0.258:246040)
    at call (ext-all-debug.js?v=6.6.0.258:22382)
    at Object.elevate (ext-all-debug.js?v=6.6.0.258:2574)
initAnimation   @   ext-all-debug.js?v=6.6.0.258:256492
invalidate  @   ext-all-debug.js?v=6.6.0.258:258522
flushInvalidates    @   ext-all-debug.js?v=6.6.0.258:258319
run @   ext-all-debug.js?v=6.6.0.258:258853
flushLayouts    @   ext-all-debug.js?v=6.6.0.258:72198
resumeLayouts   @   ext-all-debug.js?v=6.6.0.258:72213
Ext.resumeLayouts   @   ext-all-debug.js?v=6.6.0.258:78184
syncLockedWidth @   ext-all-debug.js?v=6.6.0.258:246040
call    @   ext-all-debug.js?v=6.6.0.258:22382
elevate @   ext-all-debug.js?v=6.6.0.258:2574
timerFn @   ext-all-debug.js?v=6.6.0.258:7590
setTimeout (async)      
defer   @   ext-all-debug.js?v=6.6.0.258:7593
me.delay    @   ext-all-debug.js?v=6.6.0.258:22436
delaySyncLockedWidth    @   ext-all-debug.js?v=6.6.0.258:245947
fire    @   ext-all-debug.js?v=6.6.0.258:22895
doFireEvent @   ext-all-debug.js?v=6.6.0.258:23935
doFireEvent @   ext-all-debug.js?v=6.6.0.258:74953
prototype.doFireEvent   @   ext-all-debug.js?v=6.6.0.258:66470
fireEventArgs   @   ext-all-debug.js?v=6.6.0.258:23789
fireEvent   @   ext-all-debug.js?v=6.6.0.258:23746
add @   ext-all-debug.js?v=6.6.0.258:158319
(anonymous) @   simeo.min-dev.js:9786
columnSwitch    @   simeo.min-dev.js:9781

Please, help me to understand where I'm wrong...

Nico C
  • 11
  • 1

0 Answers0