Javascript/Sencha

Sencha grid의 특정 header의 filter 제거하기

바리새인 2025. 1. 11. 11:55

CSS 추가

/* Hide filter dropdown in grid header for columns with 'hide-filter-trigger' class */
.hide-filter-trigger .x-column-header-trigger {
    display: none !important;
}

이벤트 추가

 

listeners: {
    afterrender: function (grid) {
        // Define columns for which the filter dropdown should be hidden
        const columnsToHideFilter = ['test', 'temp'];

        // Hide the filter dropdown for specific columns
        grid.getColumns().forEach(function (column) {
            if (columnsToHideFilter.includes(column.dataIndex)) {
                const header = column.getEl(); // Get the column header element
                if (header) {
                    header.addCls('hide-filter-trigger'); // Add custom class to hide dropdown
                }
            }
        });
    }
}