Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Can changeDefaults() be used for nested auto children?

    I have a custom grid class (extending ListGrid) with auto children for buttons in it. I now want to use this grid itself as auto child of a Controller class. When the grid is part of this controller, I want some properties of the buttons different. I was wondering if this can be changed via changeDefaults(). I have a working thing by changing the *Properties, but was wondering if this is the right approach.

    Code:
    isc.defineClass('MyGrid', isc.ListGrid).addProperties({
      createButtonConstructor: 'ToolStripButton',
      createButtonDefaults: {
        title: 'Show',
        click: function() {
          doSomething();
        }
      }
    });
    
    isc.defineClass('MyController', isc.TabSet).addProperties({
      gridConstructor: 'MyGrid',
      gridDefaults: {
        init: function() {
          this.createButtonProperties = isc.addProperties({
            click: function() {
              doSomethingElse(); // this is different when the grid is inside a controller, the title remains the same
            }
          }, this.createButtonProperties);
          this.Super('init', arguments);
        }
      }
    });
    
    // something like this seems to be impossible
    isc.MyController.changeDefaults('gridProperties.createButtonDefaults', {
      ...
    });
    Any comments on this?

    #2
    You could create a further subclass of the grid, call changeDefaults on that subclass, then use the subclass as a replacement gridConstructor on your MyController class.

    Comment

    Working...
    X