Issue #972Opened March 21, 2018by vrudikov0 reactions

[FEATURE REQUEST] Allow Trait API clients to override and use initlialize method of TraitView class

Question

Current behaviour: When traits get added with TraitView.addType method they are extend TraitsViewer.itemView(which is TraitView). When TraitSelectView class extends TraitView it overrides initialize(o) method and calls TraitView.prototype.initialize.apply(this, arguments); to initialize parent class(as i understand). This allows TraitSelectView to override some initializing logic. For example override this.tmpl and use custom template for a trait

For a custom trait with overridden initialize method there we gonna see an error: image

editor.TraitManager.addType('attrNoVal', {
   initialize (o) { console.log('TEST') },
})

But with the following code everything works perfect and i can override a this.tmpl and do other things dirty :) things:

editor.TraitManager.addType('attrNoVal', {
initialize (o) {
      // Dirty hack :) But it works
      editor.TraitManager.getTraitsViewer().itemView.prototype.initialize.apply(this, arguments)
    },
})

Expected behaviour: Allow Trait API clients to override and use initlialize method of TraitView class so we can easily customize initializing logic of a trait

Answers (1)

artfMarch 24, 20180 reactions

Hi @vrudikov I didn't get what do you suggest. Would you like to have some kind of init() method which acts as a callback after the initialization?

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.