need to toggle AutoFitColumns from clientside event using Column menu

1 reply. Last post: July 25, 2017 12:45 PM by Sachin Jain
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Sachin JainMember

Hi,

I was trying to use BestFit option to toggle AutofitColumns property. Please check my code for what need to do to modify the existing Bestfit option. I can use hiddenfield variable to store last selected option of user. My code is


function WebGrid1_OnColumnContextMenu(controlId, column, menu, isGroup, location) {
for (i = 0; i < menu.Items.length; i++) {
if (menu.Items[i].Name =="mnuBestFit") {
var grid = ISGetObject(controlId);
if( document.getElementById('hdnCurrentBestFit').value == "1")
{
document.getElementById('hdnCurrentBestFit').value = "0";
grid.LayoutSettings.AutoFitColumns = false;
}
else
{
document.getElementById('hdnCurrentBestFit').value = "1";
grid.LayoutSettings.AutoFitColumns = true;
}
}
}
}

regards

Sachin

All times are GMT -5. The time now is 11:13 PM.
Previous Next