Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Ext.js button toggle functions is not working as intended

I have a Ext window (Ext v3) that contains a toolbar with a toggleGroup. My goal is to keep the buttons toggled state so when the window is opened the buttons are toggled the way they were before.

My Tbar looks like this

new Ext.Toolbar({
            items: [
                {
                    'xtype': 'button',
                    'text': 'Order Alerts',
                    'listener': 'alertsOnClick',
                    'listenerType': 'click',
                    'enableToggle': 'true',
                    'toggleGroup': 'buttonTabs',
                    'id': 'order_all',
                }
            ]
        })

I'm recording the ids by onclick like so

   function alertsOnClick(){
    return function () {
        grid.currentButton = this.id;
    }
}

When the window is opened I wait for the store to finish by using .load() with a call back function that runs

    const gridStore = Ext.getCmp('some_id').getStore();
    if(!window.grid || grid.type === 'clear') {
        window.grid = { };
        window.grid.type = 'clear';
        window.grid.currentButton = 'all_filter'
        Ext.getCmp(grid.currentButton).toggle();
        gridStore.filter(grid.field, grid.type);
        return undefined;
    }
    gridStore.filter(grid.field, grid.type);
    let t = Ext.getCmp(grid.currentButton);
    // TODO: Find out why you need to toggle this three times to get it to work
    t.toggle();
    t.toggle();
    t.toggle();

If I call .toggle() once it does not work but, it seems to work if I spam .toggle() an odd number of times. Part of me thinks that the buttons themselves are not really destroyed on close but, their CSS is cleared. I'm not sure if that's the case though. Any thoughts on how to handle this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I was abled to fix this by removing the toggleGroup, and keeping track of the prev clicked button and .toggling(false) it

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!