I recently added Grid Column Menus to my grid, primarily to give the user the ability to hide/show columns.
I want some columns hidden by default, and the user to have the ability to display them if needed. So, using the MVC helpers, I set Visible(false) like so:
However, to my surprise, columns hidden in this manner do not show up in the column menu. It's like they don't exist.
I was able to get it working correctly by loading all columns as normal and then hiding certain ones via JavaScript:
But I have 2 issues with this:
A) There is some graphical stutter as the columns are noticably loaded and then hidden.
B) I shouldn't have to do this. Setting a column as .Visible(false) should still have that column appear in the Menus.
Is this a bug? Why does setting a column as .Visible(false) cause it to act like it does not exist, in regards to the Column Menu? I wish I didn't have to write 10+ extra lines of script to do this.
Thanks.
.ColumnMenu(menu => menu.Columns(
true
).Sortable(
false
))
column.Bound(c => c.Submitter).Title(
"Submitter"
).Visible(
false
);
I was able to get it working correctly by loading all columns as normal and then hiding certain ones via JavaScript:
$(document).ready(
function
() {
var
grid = $(
'#issueGrid'
).data(
'kendoGrid'
);
grid.hideColumn(
'Submitter'
);
But I have 2 issues with this:
A) There is some graphical stutter as the columns are noticably loaded and then hidden.
B) I shouldn't have to do this. Setting a column as .Visible(false) should still have that column appear in the Menus.
Is this a bug? Why does setting a column as .Visible(false) cause it to act like it does not exist, in regards to the Column Menu? I wish I didn't have to write 10+ extra lines of script to do this.
Thanks.
Your solution worked perfectly for me.
Thanks!