With jqGrid if width of columns ar开发者_开发问答e not specified, they share the width of the grid equally. (ie. if the width of grid is 400px and there are 4 columns, they all occupy 100px width). Is there an option to handle this in a smart way so width of the columns can be upon their content?
For example let's say there are two columns: name and info. Assuming average length of names is 60 chars, whereas average length of info is 400 chars. If the grid has a width of 460px, name column should has a width of 60px and info column should has a width of 400px.
Some kind of autowidth-to-content functionality is needed. I think there is a little possibility about that because if I dynamically resize the grid, then the width columns somehow changes and fits according to their contents.
Thanks in advance.
You could dynamically resize the grid in the `loadComplete', to make column width better fit the content. Normally I will just choose column widths that are satisfactory for each row and that tends to be good enough. There is also a method for showing an ellipsis for content that is too wide to fit within a column, although unfortunately the technique is error-prone in firefox.
精彩评论