Efficient way to use Best Fit on all coulmns

3 replies. Last post: August 1, 2016 8:21 AM by Sachin Jain
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Sachin JainMember

Hi,

Some of our webgrid pages have large number of columns say more than 25. To show columns properly we made AutoFitColumns="false" ; so horizontal scroll bar appear and columns headers are readable now. Still for columns having large text say more than 35 charcters; text were not readable without resizing the column. Most of columns of such grids require resize.

We tried to use webgrid's inbuilt functionality "Best Fit" for all columns. We do it by below function which is based upon http://developer.intersoftsolutions.com/display/WebUI/Set+the+Column's+Best+Fit

$(document).ready(function () {
var grid = ISGetObject('WebGrid1');
for (i = 0; i < grid.RootTable.Columns.length; i++) {
(grid.RootTable.Columns.GetNamedItem(grid.RootTable.Columns[i].Name)).ResizeBestFit();
}
});

It makes those page 3-4 times slower and reason behind it that it is done after document is ready.

Is it any efficient way exist which can help us to meet the goal without making page  slower?

thanks and regards

Sachin


All times are GMT -5. The time now is 7:48 PM.
Previous Next