Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

259
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda