Search code examples
javascriptextjsgridpanel

ExtJS: Toggling visibility of GridPanel header at runtime


I have a GridPanel which should load a maximum number of resources. If there are more resources available, than I want to show, I want to enable the panel's header/title to show some texte like "more items available - display cut off".

My problem is: I can set the header to be hidden oder shown in the config options, but how can I change the visibility at runtime, specificially just when the grid's store has loaded a new set of record, depending on whether the number of records loaded exceeds a certain maximum or not?

If possible, please give your answers compatible to Ext 2.x.

Thanks for your help!


Solution

  • Try this:

    if (grid.rendered) {
        grid.header.hide();
        // grid.header.setStyle('display', 'none');
    } else {
        grid.on('afterrender', function() {
            grid.header.hide();
            // grid.header.setStyle('display', 'none');
        }, grid, { single: true });
    }
    

    If you have hideMode to visibility use commented code (this with setStyle).