9 Answers, 1 is accepted
You can use the resizeToFit method to resizes the column to fit the widest cell's content without wrapping.Please try the below code snippet.
If you set the resizeToFit property,then all the column will be made to fit its contents so you don't have to set the width for every column.If you want to add extra width styles to the column,you can use HeaderStyle and ItemStyle.There is no restriction as such.
Please try the code and let me know if any concern.
thanks alot for your concern.. i tried the code for making the columns fit the content and its working great .. but i have another problem .. under the column header i have the default filter of the radgrid and this not fully appear for every column .. i attached an image for the grid in the post you can see the first column "StoreID" the filter not fully appear and alot of columns like that .. please let me know if there is any solution to solve that ..
I tried the code and I'm also facing the same issue.Since you are using filtering another work around would be to be set the column width for those columns that are not visible when using resizeToFit.Please try the below code snippet.
You can use the resizeToFit method for all columns except the mentioned one:
Hope this helps.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
resizeToFit method is not working when OnPageIndexChanged event is called. OnPageLoad function it fits the columns accordingly but when i change the page index , it taking HeaderStyle-Width and does not fit to content.