Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

248
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda