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

Bug? Cannot hide column from column menu

5 Answers 352 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anna
Top achievements
Rank 1
Anna asked on 03 Feb 2016, 11:11 PM

With the following grid setup, I cannot hide a particular column through the column menu. Is it a bug?

Grid setup (plunk <= try reproduce it here!)

  • columnMenu: true
  • 1 column (FirstName) with locked = true, lockable = false, menu = false
  • 1 column (LastName) with locked = true, lockable = true
  • at least 1 more column with locked = false

If I go to the grid's Column Menu, and go to Columns option. The LastName column's checkbox is disabled - I can't hide that column now. On the other hand, if LastName column has locked = false, the checkbox in the Column Menu is enabled, and I can hide the column.

Best,

Ama

 

5 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 05 Feb 2016, 06:27 AM
Hello Ama,

This is the default behavior of the frozen columns functionality, which requires at least one locked column to be visible. Detailed information on the locked columns could be found in the following help article:
Hope this helps.


Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anna
Top achievements
Rank 1
answered on 05 Feb 2016, 05:54 PM

Hi Konstantin,

Please give my plunk a try. For my instance, I do have at least 2 visible locked columns, First Name, Last Name, and multiple visible unlocked columns. I don't see any reason why the Last Name column cannot be hidden.

 

Best,

 

Ama

0
Dimo
Telerik team
answered on 10 Feb 2016, 07:38 AM
Hello Ama,

The column menu is not aware of columns with a menu: false setting. Since the LastName is the only frozen column in the Column Menu, and the menu knows that at least one frozen column must be visible, it does not allow it to be hidden.

Please enable the column menu for the FirstName column. If needed, you can disable sortability or filterability specifically for this column.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.sortable

In case you would like to submit a feature request for changing this behavior, please refer to:

http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Anna
Top achievements
Rank 1
answered on 11 Feb 2016, 04:59 PM

Hello Dimo,

What we really want is disallow user to hide the Name column. Is there a way to show the column in the menu, but show as disabled?

ps. I still think for the scenario I presented, the menu should behave consistently to what's actually shown in grid - with 2 locked visible column, last name column should be allowed to hide. 

 

Best,

 

Ama

0
Accepted
Dimo
Telerik team
answered on 15 Feb 2016, 11:47 AM
Hello Ama,

You can achieve the desired behavior by allowing the column menu to handle the Name column, but disable its checkbox programmatically in the columnMenuInit event.

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-columnMenuInit

function onColumnMenuInit (e) {
    var checkbox = e.container.find(".k-columns-item ").find("input[data-field='YourFieldName']");
 
    checkbox.attr("disabled", "disabled");
    checkbox.closest(".k-item").addClass("k-state-disabled");
}


On a side note, if the user should not hide a particular column, probably there is a reason why he wouldn't want to do that, so explicitly disabling the checkbox is not required, since the column can be easily displayed back, if hidden by accident.

Regards,
Dimo
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
Anna
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Anna
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or