<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Auto-sizing the columns</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>friflaj on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p12065</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p12065</guid>
        	        	<description><![CDATA[<p>I see. So this is not likely to be a useful approach for the short term. Is there a workaround?</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 06:38:27 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p12024</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p12024</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>If you try this with FireFox 3.5 on Linux or FireFox and Safary on Mac there is a bug which is corrected - also it is not actually a bug in jqGrid, but in FireFox.</p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 00:31:10 +0200</pubDate>
        </item>
        <item>
        	<title>friflaj on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11899</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11899</guid>
        	        	<description><![CDATA[<p>I&#39;m currently looking at something like this (call with resizeColumns(&#39;#yourgrid&#39;, [&#39;colname1&#39;, &#39;colname2&#39;]):</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5448' value='Select Code' data-codeid='sfcode5448' /></p>
<div class='sfcode' id='sfcode5448'>&#160;&#160;&#160; function resizeColumns(id, cols) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var grid = $(id);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var cfgstring = grid.jqGridExport({&#39;exptype&#39;: &#39;jsonstring&#39;});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; //var config = JSON.parse(cfgstring, function(k, v) { return v; });<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; eval(&#39;config = &#39; + cfgstring);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rows = grid.getRowData();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var widths = new Array();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (col in cols) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colname = cols[col];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; widths[colname] = 0;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (rownum in rows) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; row = rows[rownum];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (col in cols) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colname = cols[col];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#measure&#39;).html(&#39;&#60;span&#62;&#39; + row[colname] + &#39;&#60;/span&#62;&#39;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; w = $(&#39;#measure span&#39;).width();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (w &#62; widths[colname]) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; widths[colname] = w;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var colModel = config[&#39;grid&#39;][&#39;colModel&#39;];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (col in colModel) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (colModel[col][&#39;name&#39;] in widths) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel[col][&#39;width&#39;] = widths[colModel[col][&#39;name&#39;]];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; grid.jqGridImport({&#39;imptype&#39;:&#39;jsonstring&#39;, &#39;impstring&#39;:JSON.stringify(config)});<br />&#160;&#160;&#160; }</p>
</div>
<p>Currently, jqGridExport({&#39;exptype&#39;: &#39;jsonstring&#39;}) throws an error:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1987' value='Select Code' data-codeid='sfcode1987' /></p>
<div class='sfcode' id='sfcode1987'>Error: $t.p.colModel[i] is undefined<br />Source File: <a href="http://projecten.han-imao.nl:8000/agilito/js/jquery.jqgrid/js/jquery.jqGrid.min.js" rel="nofollow" target="_blank">http://projecten.han-imao.nl:8000/agilito/js/jquery.jqgrid/js/jquery.jqGrid.min.js</a><br />Line: 10</div>
<p>I know the eval is stupid, but when I use JSON.parse I just get</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4939' value='Select Code' data-codeid='sfcode4939' /></p>
<div class='sfcode' id='sfcode4939'>Error: JSON.parse<br />Source File: <a href="http://projecten.han-imao.nl:8000/3/iteration/62/" rel="nofollow" target="_blank">http://projecten.han-imao.nl:8000/3/iteration/62/</a><br />Line: 223</div>
</p>
<p>Any clues appreciated.</p></p>
]]></description>
        	        	<pubDate>Fri, 13 Nov 2009 08:02:46 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11843</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11843</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>You should consider my answer NO as challenge too <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 12 Nov 2009 10:11:39 +0200</pubDate>
        </item>
        <item>
        	<title>friflaj on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11790</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11790</guid>
        	        	<description><![CDATA[<p>I take that as a challenge <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_wink.gif" alt=";)" /></p>
<p>I&#39;m getting closer: I can calculate an approximation of the width for a specific column by finding the width of, for example, the first cell:</p>
<p>&#60;div id=&#8221;measure&#8221; style=&#8221;visibility:hidden&#8221;/&#62;</p>
</p>
<p>and in loadComplete:</p>
<p>$(&#39;#measure&#39;).html(&#39;&#60;span&#62;&#39; + $(&#39;#treegrid2 tbody tr:first td:eq(1)&#39;).text() + &#39;&#60;/span&#62;&#39;);</p>
<p>alert($(&#39;#measure span&#39;).width());</p>
</p>
<p>I realize that the cell selection should use getCell, but that always returns false for me, I&#39;ll keep poking at that. So how do I use this width value to set the width of a column after load? Between <a rel="nofollow" href="/jqgridwiki/doku.php?id=wiki:methods&#38;s=getcell" target="_blank"></a><a href="http://www.trirand.com/jqgridw" rel="nofollow" target="_blank">http://www.trirand.com/jqgridw</a>.....;s=getcell I don&#39;t see anything that fits the bill.</p>
]]></description>
        	        	<pubDate>Wed, 11 Nov 2009 04:46:57 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11780</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11780</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Many times disscused - the answer is No.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 11 Nov 2009 03:22:49 +0200</pubDate>
        </item>
        <item>
        	<title>friflaj on Auto-sizing the columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11735</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/auto-sizing-the-columns#p11735</guid>
        	        	<description><![CDATA[<p>Is there a way (by config or by jquery code) to set the column widths to reasonable defaults, much like the regular html table behaves when you don&#39;t set any explicit column widths?</p>
]]></description>
        	        	<pubDate>Tue, 10 Nov 2009 09:43:06 +0200</pubDate>
        </item>
</channel>
</rss>