discoveryjs / discovery

A framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
https://discoveryjs.github.io/discovery/
MIT License
343 stars 6 forks source link

Possibility to create own burger items #73

Closed smelukov closed 3 years ago

smelukov commented 3 years ago

I want to create a burger-like button (show custom popup on click) Will be great if it will work out of the box

lahmatiy commented 3 years ago

Currently it's possible this way:

let popup = new discovery.view.Popup({
    className: 'your-popup' // optional
});
discovery.nav.append({
    name: 'your-name',  // optional
    onClick(el, data, context) {
        popup.toggle(el, (popupEl) => discovery.view.render(popupEl, [
            'text:"popup content goes here"'
        ], data, context);
    }
});

Perhaps in the future it will be possible to define a popup in the config, which will eliminate the need to create a popup instance aside.