Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7546409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:11:26+00:00 2026-05-30T09:11:26+00:00

This is a follow-on question to Is publishing/subscribing to events after UI rendering a

  • 0

This is a follow-on question to Is publishing/subscribing to events after UI rendering a best practice regardless of framework? which I asked last month as we first went down the pub/sub path with a Javascript/ExtJS application. If you want to get to the meat of my question from a purely publish-subscribe standpoint, please see the first, emphasized, sentence of the next to last paragraph. First a bit of context:

We have a panel that contains a tab-panel whose cards hold a grid panel, and a panel that holds a form for filtering the grid data. In the beforechangetab event we add/remove a shared grid and publish GRID_TAB_TOGGLED message along with a flag indicating stocked or non-stocked, and the grid then reloads with the appropriate data.

As for the filters, the code I inherited relied on just one form, and combo box choices get modified based on the loaded stocked/non-stocked data, but now we are required to retain all of the filter state. My initial idea is to use a card layout for holding either stocked or non-stocked filters, and toggling between these in response to the same GRID_TAB_TOGGLED message.

The issue though is that both of these filter forms need to listen for other, numerous, identical events. I think I’ve determined a solution, and am seeking design validation.

My idea is for the different forms to be able to determine whether they are the “active” (stocked or non-stocked) filters, and if active, subscribe to all necessary messages, but if not active, unsubscribe from them all. This un-subscribing, re-subscribing then would occur whenever the GRID_TAB_TOGGLE message was received.

Does this seem like a reasonable design, from an ExtJS standpoint, but of more interest to me (since I have nearly 3 years ExtJS experience, but only 1.5 months implementing my own pub/sub based system), from a publish/subscribe paradigm standpoint? Perhaps this is even a pattern (or, though I hope not, an anti-pattern) for pub/sub based systems?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:11:27+00:00Added an answer on May 30, 2026 at 9:11 am

    I would avoid excessive subscribing/unsubscribing. If you are completely removing a component, then it’s obvious that you should unsubscribe it from all the events. But when you are just disabling the component temporarily, then you should also just disable the events temporarily.

    So, instead of unsubscribing from all the events and then re-subscribing to them again I would use some kind of mediator that would forward me all the events and would allow to easily suspend all its events. This should be easy to implement using #suspendEvents and #resumeEvents of Ext.util.Observable.

    Ext.define("EventMediator", {
        extend: "Ext.util.Observable",
        constructor: function(cmp, events) {
            this.relayEvents(cmp, events);
            this.callParent([]);
        }
    });
    
    var med = new EventMediator(grid, ["click", "dblclick"]);
    
    med.on("click", form.doSomething);
    med.on("dblclick", form.doSomethingElse);
    
    // When form gets hidden:
    med.suspendEvents();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow up question to a previous question I asked about calculating
This is a follow-on question from the one I asked here . Can constraints
This is a follow-up question to this question I asked earlier. Btw thanks Neil
this is a follow-up question to my last one here: iOS: Initialise object at
Disclaimer: This is a follow-on question from my other question about NServiceBus which was
This is follow-up question after on my question . Folder subfolders imagefolder important.txt index.txt
This is a follow up question of this question , which is not really
This is a follow up question from Calling constructor in return statement . This
This is a follow-up question to ASP.NET How to pass container value as javascript
this is a follow-up question of mine. Suppose now I have a URL :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.