Devexpress grid – header filter does not work if column is initially hidden

aspxgridviewdevexpress

I'm using a DevExpress grid and I'm trying to get a 'Country' column to display the header filter properly:

<dx:GridViewDataColumn Caption="Country" FieldName="CountryName" 
    ShowInCustomizationForm="True" Visible="false">
    <Settings AllowHeaderFilter="True"/>
</dx:GridViewDataColumn>

If the 'Country' column is set to Visible='true', then the header filter is displayed as it should(it shows the value option list). However, I want the 'Country' column to be initially hidden, but available in a Customization window(like in the code above). In this case, when the column is dragged outside the Customization window and into the grid and the header filter is clicked, a Javascript error is encountered:

element is null
element.addEventListener(eventName, func, true);

Is this a known bug? Are there any workarounds?

Best Answer

Set the ASPxGridView.Settings.ShowHeaderFilterButton property to true to resolve this problem.

The following markup works fine for me (I am using DXperience 10.1.7):

<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/nwind.mdb"
    SelectCommand="SELECT * FROM [Categories]"></asp:AccessDataSource>
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" ClientInstanceName="grid"
    DataSourceID="AccessDataSource1" KeyFieldName="CategoryID">
    <SettingsCustomizationWindow Enabled="True" />
    <Columns>
        <dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
            <EditFormSettings Visible="False"/>
            <Settings AllowHeaderFilter="False" />
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataTextColumn FieldName="CategoryName" Visible="False" VisibleIndex="1">
            <Settings AllowHeaderFilter="True" />
        </dx:GridViewDataTextColumn>
        <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2">
        <Settings AllowHeaderFilter="False" />
        </dx:GridViewDataTextColumn>
    </Columns>
    <Settings ShowHeaderFilterButton="True" />
</dx:ASPxGridView>
Related Topic