Golden-layout: Example in documentation not quite correct?

Created on 25 May 2021  Â·  4Comments  Â·  Source: golden-layout/golden-layout

Current behavior

I am currently following the example in the documentation (love it btw).

https://golden-layout.com/tutorials/getting-started.html

The documentation suggests that in this callback:

myLayout.registerComponent( 'testComponent', function( container, componentState ){
    container.getElement().html( '<h2>' + componentState.label + '</h2>' );
});

the type of container.getElement() is a JQuery element. However I get an "html not defined" error. When debugging this in the browser a plain DOM/HTMLElement is returned in getElement().

So doing

container.getElement().innerHTML = "<h2>….</h2>";

Seems to be working. This sounds like jQuery is no longer used by golden-layout? This is awesome news! Just wanted to check I was not doing anything wrong and if the documentation can be updated? Happy to send a PR if this is the case.

Expected behavior:

Documentation is referring to (possibly) when jQuery was a dependency? If jquery is no longer needed documentation should reflect plain HTMLElement's in action.

Codepen example:
N/A

Bug Documentation

Most helpful comment

Hi @KonradHoeffner,

Yes - we certainly need some better documentation. Unfortunately I don't have the time to do this and currently, there is no plan or estimated date for this. Maybe #690 will lead to some better documentation.

All 4 comments

Documentation at https://golden-layout.com/tutorials/getting-started.html is applicable to release 1.5.9. Documentation covering differences between 1.5.9 and 2 is at https://github.com/golden-layout/golden-layout. (It mentions jQuery is no longer used.)

Currently, the best way of learning is to use both documentation sources. https://golden-layout.com/ to get an initial understanding and https://github.com/golden-layout/golden-layout to see how it works in version 2.

Hey thanks for getting back. My bad - I hadnt realized that I was looking at 1.5.9 version of the documentation while using v2.2. Also could explain why "popouts, minimize/maximize" buttons arent showing up when following the example?

Is there a plan and an estimated date for the update of the tutorial to version 2? I would like to update my application to GoldenLayout 2 but I did not succeed using the documentation in the README file of this repository and would like to try it again when an updated tutorial becomes available.

Hi @KonradHoeffner,

Yes - we certainly need some better documentation. Unfortunately I don't have the time to do this and currently, there is no plan or estimated date for this. Maybe #690 will lead to some better documentation.

Was this page helpful?
0 / 5 - 0 ratings