attachHeader filter all columns

Hello,

I am trying to set the the filter option dynamically by getting the ColumnCount and looping to add the text_filter but I am having issues since the data has to be loaded first before returning a count for the mygrid.getColumnCount().

I have tried within grid.attachEvent “onXLE” as well but the header is returning the text string on the first row, my guess is that it doesn’t work with the attachHeader. Do you have any other solutions to set the header filters since our columns are dynamic with a different columns total ?

Sample code (first option should be #select_filter and after that they should all be set to #text_filter depending on the total columns):

function setfilters(){
        var colcount = grid.getColumnCount();
        var output = '';
        for(var i = 1; i < colcount; i++){
        var filters =  ",#text_filter";
        output += filters;
        }
        return output;
        }
        grid.attachHeader("#select_filter" + setfilters());

Thank you,

Pele

Your code works well for us from an onXLE event.
Please, make sure that you have added setSizes() after the attaching the header.
If issue still occurs - please, provide a complete demo where the issue can be reproduced.

Thank you for the reply. I will try that but I got it to work by passing the column count using php.

Thanks again.

Pele