Issue #2083Opened June 17, 2019by afdallah2 reactions

[QUESTION] model.get('toolbar') always return null

Question

Hi @artf I am trying to add a custom toolbar to my custom component without changing the default toolbar. So I expect it to be like [movable, copyable, removable, newToolbar]. I use this #266 as a reference.

model: {
  // ...
  initToolbar () {
    const tb = this.get('toolbar')

    console.log(tb) // Return null
    tb.unshift({
      attributes: { class: 'fa fa-plane' },
      command: 'some-command'
    })

    this.set('toolbar', tb)
  },
  // ...
}

But strangely this.get('toolbar') always return null. Is this something normal?

I got this instead toolbar image

Answers (3)

afdallahJuly 12, 20191 reactions

I am so sorry, it's my mistake. Thanks for your guidance

artfJuly 2, 20190 reactions

Yes, if you override the original initToolbar method the toolbar property is never created, so you have to call the parent one first. Try with this component creation helper

extendFn: ['initToolbar'], // array of model functions to extend
model: {
  // ...
  initToolbar () {

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.