This is a migrated thread and some comments may be shown as answers.

Hide filter button in header for one column (but keep cell filter)

2 Answers 463 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 28 Aug 2014, 06:33 PM
I have a column with only two possible values, and I have put a kendoDropDownList in the filter cell for that column. Now the filter button above, in the main header cell, makes no sense. How can I hide just the one button?

See attached image.

This  is the code that initializes the column:

           
field: 'IsInstr',
                title: 'Instr',
                width: 70,
                headerAttributes: {
                    "title": "Instrument or Component",
                },
                filterable: {
                    extra: false,
                    cell: {
                        template: function (input) {
                            input.kendoDropDownList({
                                autoBind:false,
                                dataTextField: "text",
                                dataValueField: "value",
                                valuePrimitive: true,
                                dataSource: instValus,
                                text: 'Both'
                            });
                        },
                        showOperators: false,
                        inputWidth: 75
                    }
                },

2 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 28 Aug 2014, 09:00 PM
OK, this works:
1.var tbl = $($('#gridDiv1 table')[0]).find('tr th.k-header');
2.var filtButn = $($(tbl).filter(function () { return $(this).attr('data-field') === "IsInstr"; })[0]).find('.k-filter')[0];
3.$(filtButn).css('display', 'none');

But there must be some cleaner way???

Bob


0
Accepted
Kiril Nikolov
Telerik team
answered on 29 Aug 2014, 01:10 PM
Hello Robert,

As the functionality that you are looking for is not supported out of the box, you will need to find a custom way to achieve this. The easiest way is to use jQuery to change the display property, so I do not see a reason why not to use your approach.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or