admin-extension-sdk icon indicating copy to clipboard operation
admin-extension-sdk copied to clipboard

Feature request: Add an event emitter for click event on `sw-tabs`

Open crisalder2806 opened this issue 2 years ago • 3 comments

sw-tabs is not emitting anything out currently, so we don't know which is the active item. Could you help to add it?

crisalder2806 avatar Nov 04 '22 03:11 crisalder2806

Thanks for the suggestion. Can you give an example use case where you need it? Then it is easier to create a good solution which also covers your case

jleifeld avatar Jan 19 '23 11:01 jleifeld

HI, e.g. you add a specific app tab into sw-product-detail which is loading information from an external source or does some other things. Now you only want to start loading the content of the tab if its active to reduce load on the server and also make the ui faster.

another example. i try to load per app a custom entity table which lists all transaction information for an order and presents details, i currently do not now what order i'm actively looking at and need to use sessionstorage to save the entity.id per data subscribe on sw-order-detail-base__order. unfortunately this event is only triggered on a page refresh when im on the general tab, not if i refresh on my custom tab, requires to currently switch between tabs to get this information.

cheers, Horst

horfic avatar Mar 16 '23 08:03 horfic

Please correct me if I'm wrong but this sounds like the SDK should be capable of this already.

Let me elaborate on what I expect to happen with tabs.

  1. You add a tab via:
ui.tabs('sw-product-detail').addTabItem({
    label: 'Example tab',
    componentSectionId: 'example-product-detail-tab-content'
})
  1. Module loads and the General Tab is displayed 2.1 Your app iframe is not displayed and therefore should not load any data
  2. The user clicks your tab you load your data

The second part you mentioned @horfic sounds like a different problem for me. The issue is not that you don't know which tab you are on but more that the relation between tab and parent module information is missing.

Please correct me on any of these points, if I misunderstood something 😊

seggewiss avatar Feb 12 '24 06:02 seggewiss