I'm developing a web application and I'm using a lot of grid. I'm trying to avoid having a lot of customization for each one of them. I'd like that the grid set each column's initial width based on the content. I. e.:
Short name NameJF John FooAB Ana Bar
All values for 'Short name' are 2 chars long, and the longest value for 'Name' is 'John Foo' with 8 chars. So in this case, the grid should set 'Short name' column's width to 20%, and 'Name' column's width to 80%.
In case this functionality does not exisist, could you give me some clues so I know where to start building it?
Thanks,Diego
Hi,
Thank you for posting in Infragistics forums! Currently we are working towards improving this functionality. You can expect it in one of our future Service Releases. Until then you can set the width of the columns manually in grid’s options.
Kind regards, Petko Zhekov Software Developer
Hello Petko, thanks for the quick response.
Is there any way I can keep updated about this feature progress?
Thanks,Diego.
Hi intecomp,
To enable auto sizing of the column you need to set its width to “*”.
Let me know if you have any further questions!
Kind regards,
Petko Zhekov
Software Developer
I've just tried. I couldn't get it working.
I keep getting the error: Can't get property 'getBoundingClientRect' from null or undefined.
Based on what I could see in the min version, this happens when the real width is calculated: col.width=Math.ceil($firstRowCells[index].getBoundingClientRect().width);
I've a grid width 4 columns, the first of them is hidden. The error is when it is calculating the last width (for the 4th column) and its because index is 3 and $firstRowCells's length is also 3.
Edit:
I believe this is related to the versions I'm using. I've made this fiddle (replace the *** in the URL with p a s k a without the spaces) which works fine but I use the same code in my environment and it fails. Here are the details:
Hello.
I just wanted to check if you had seen the error and if its bug or I am using it wrong.
I wrote you in the case. Did you have the chance to see my message? You can see it in the ACTIVE CASES tab in the Support Activity section in your account.
I haven't received any emails, so I hadn't seen it.
I'll download it and give it a try.
Thanks Petko!
No, now it's working.
Thanks!
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
Kind Regards,
Infragistics, Inc.