Skip to content

SplitPanel has 0 width and height #675

Open
@pplonski

Description

@pplonski

I'm trying to use SplitPanel in a widget that is used in Jupyter Lab extension. I'm able to add SplitPanel and it is displayed in the html source but it has width and height 0.

Below is the class that I'm displaying:

export class PPPanel extends Panel {
  constructor(options: PPPanel.IOptions) {
    super();
    this.addClass('jp-Notebook');
    this.addClass('jp-NotebookPanel-notebook');
    this.addClass('grid-panel');

    this.node.dataset['jpUndoer'] = 'true';

    this._context = options.context;
    this.rendermime = options.rendermime;
    this.contentFactory = options.contentFactory;
    this.mimeTypeService = options.mimeTypeService;
    this._editorConfig = options.editorConfig;
    this._notebookConfig = options.notebookConfig;

    // this one is displayed alone ok if uncommented
    // const t = document.createElement('div');
    // t.textContent = 'Ola koduje3';
    // const a = new Widget({ node: t });
    // this.addWidget(a);

    const splitPanel = new SplitPanel();
    splitPanel.id = 'my-split-panel';

    const left = new Panel();
    const right = new Panel();

    const t1 = document.createElement('div');
    t1.textContent = 'Ola koduje4';
    const a1 = new Widget({ node: t1 });
    left.addWidget(a1);

    const t2 = document.createElement('div');
    t2.textContent = 'Ola koduje5';
    const a2 = new Widget({ node: t2 });
    right.addWidget(a2);

    splitPanel.addWidget(left);
    SplitPanel.setStretch(left, 0);

    splitPanel.addWidget(right);
    SplitPanel.setStretch(right, 1);

    this.addWidget(splitPanel);
  }

Here is screenshot showing html source:
image

Node with text content is in the html source but it is not displayed. I expect that SplitPanel will show both texts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions