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

Rad Grid Header Context Menu - Maintain State

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 28 Jan 2009, 03:00 AM
For those of you that are looking on how to maintain state of the columns that are marked not visible. The problem is that when you have a column that is marked as not visible and then you select to show that with the column picker, it does not maintain the state. The way that we got it to do it is by this:

// Finds all the checkboxes in the context menu.

$(

function() {

 

$(

":checkbox").filter(function() {

 

 

return this.id.match('rghcMenu')

 

}).click(

function() { OnContextMenuClick(this) });

 

}

);

var

 

columnHash;

 

// Triggered when the columns slide open.

function

 

OnHeaderContextMenuClientItemOpened() {

 

 

for (var key in columnHash) {

 

 

var control = document.getElementById(key);

 

control.checked = columnHash[key];

}

}

// Maintains the state of the checkbox.

function

 

OnContextMenuClick(checkBox) {

 

 

if (columnHash == null) {

 

columnHash =

new Object();

 

}

columnHash[checkBox.id] = checkBox.checked;

}

and then have this in the HeaderContextMenu on the grid:

 

<

 

HeaderContextMenu OnClientItemOpened="OnHeaderContextMenuClientItemOpened" />

 

 

 


I hope that this helps people. I found it frustrating to figure out how to do it. We put ours in our skins for all themes and put the javascript and JQuery above in an embedded resource file which we load up on any page with a Rad Grid.

Mike Moser

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 30 Jan 2009, 05:26 PM
Hello Mike,

Indeed I'm able to observed the described behavior. However I'm happy to inform you that our developers has managed to addressed the issue in question. Thus the fix will be available in this year's Q1 version of RadControls for ASP.NET AJAX. You may also check the latest internal build section in your user account, the fix should be included in next week's builds. Meanwhile I have update your telerik points.

Please excuse us for the inconvenience.

Regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or