<?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: How to stretch columns</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-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/how-to-stretch-columns/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p11124</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p11124</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Will try to fix it, because of the new method gridResize.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 27 Oct 2009 03:53:38 +0200</pubDate>
        </item>
        <item>
        	<title>Hannes KÃ¤ufler on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p11083</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p11083</guid>
        	        	<description><![CDATA[<p>Hi Tony!</p>
</p>
<p>Have you gotten around to fixing this bug yet? It still occurs to me with the Git 3.5.3 Version.</p>
</p>
<p>Greeting, Hannes</p>
]]></description>
        	        	<pubDate>Mon, 26 Oct 2009 12:18:04 +0200</pubDate>
        </item>
        <item>
        	<title>HoSpiTaL_gHoSt on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10507</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10507</guid>
        	        	<description><![CDATA[<blockquote>
<p>tony said:</p>
<p>var gridWidth = parseInt($(&#39;#mailinfoGrid&#39;).getGridParam(&#8221;width&#8221;));<br />$(&#39;#mailinfoGrid&#39;).setGridWidth(gridWidth+0.01,true);</p>
<p>The grid does not change if you try to set the same width (A bug wich will be corrected soon);</p>
</blockquote>
<hr />
<p>Lol, I just discovered it when you posted the solution! Thanks a lot for your help!</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 04:33:50 +0300</pubDate>
        </item>
        <item>
        	<title>HoSpiTaL_gHoSt on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10506</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10506</guid>
        	        	<description><![CDATA[<p>I tried something else, the only difference is that I get the old grid width and I set the new grid width to the old value -1. This does stretch the columns. I think because I set the width to the same width it had before, the columns didn&#39;t stretch. Weird, but it works now!</p>
</p>
<p>var gridWidth = $(&#39;#mailinfoGrid&#39;).getGridParam("width");<br />$(&#39;#mailinfoGrid&#39;).setGridWidth(gridWidth-1,true);</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 04:32:50 +0300</pubDate>
        </item>
        <item>
        	<title>tony on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10505</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10505</guid>
        	        	<description><![CDATA[<p>var gridWidth = parseInt($(&#39;#mailinfoGrid&#39;).getGridParam(&#8221;width&#8221;));<br />$(&#39;#mailinfoGrid&#39;).setGridWidth(gridWidth+0.01,true);</p>
<p>The grid does not change if you try to set the same width (A bug wich will be corrected soon);</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 04:31:04 +0300</pubDate>
        </item>
        <item>
        	<title>HoSpiTaL_gHoSt on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10504</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10504</guid>
        	        	<description><![CDATA[<p>I tried that, and because the width of my grid has to stay the same, I just have to get the gridWidth and then set it again, but with shrinkToFit=true:</p>
</p>
<p>var gridWidth = $(&#39;#mailinfoGrid&#39;).getGridParam("width");<br />$(&#39;#mailinfoGrid&#39;).setGridWidth(gridWidth,true);</p>
</p>
<p>But this doesn&#39;t stretch the columns 🙁 it does nothing! It&#39;s really weird, but I think it&#39;s because shrinkToFit is initially set to false on construction of my jqgrid</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 04:26:59 +0300</pubDate>
        </item>
        <item>
        	<title>tony on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10500</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10500</guid>
        	        	<description><![CDATA[<p>No need to do this just call setGridWidth method with the second parameter set to true. See docs</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 04:00:17 +0300</pubDate>
        </item>
        <item>
        	<title>HoSpiTaL_gHoSt on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10497</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10497</guid>
        	        	<description><![CDATA[<p>Thanks for the reply. I tried your code, but it makes my grid as wide as the sum of the columns, but I want the opposite, i want the grid width to stay the same, but each column should stretch to "fill" the grid.</p>
<p>I&#39;m not very familiar with jQuery, so I tried out some things in regular Javascript:</p>
</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var header = document.getElementsByTagName("th");</p>
<p> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var totaal = 0;<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for(i=0; i &#60;header.length; i++){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var width = header[i].style.width;<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; totaal += parseInt(width.substr(0,width.length-2));<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var gridWidth = $(&#39;#mailinfoGrid&#39;).getGridParam("width");<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if(totaal &#60; gridWidth){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for(i=0; i &#60; header.length; i++){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; header[i].style.width = Math.floor(gridWidth/header.length) + &#39;px&#39;;<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;&#160; &#160;&#160;&#160; <br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; var cells = document.getElementById("gview_mailinfoGrid").getElementsByTagName("td");<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; for(i=0; i &#38;lt; cells.length; i++){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; cells[i].style.width = Math.floor(gridWidth/header.length) + &#39;px&#39;;<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;&#160; }</p>
<p>This code does what I want, but when you then try to resize the columns, the resize "drag line" is in the wrong location.</p>
<p>So based on your example I tried the following code to change each column width to a static value, but the column widths aren&#39;t changed?</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(totaal &#60; gridWidth){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $.each(model,function(){<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (!this.hidden) {<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; this.width = 200;<br /> &#160;&#160;&#160; &#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;&#160; &#160;&#160;&#160; });<br /> &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 03:21:27 +0300</pubDate>
        </item>
        <item>
        	<title>tony on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10495</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10495</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Maybe you need to use a setGridWidth method. Also before this you will need to determine the width of the visible columns.</p>
<p>You can do this using getGridParam method something like:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1622' value='Select Code' data-codeid='sfcode1622' /></p>
<div class='sfcode' id='sfcode1622'>
<p>var model = $("#mygrid").getGridParam("colModel");</p>
<p>var visiblewidth = 0;</p>
<p>$.each(model,function(){</p>
<p>if (!this.hidden) visiblewidth += pareseInt(this.width);</p>
<p>});</p>
</div>
<p>Hope this help.</p>
<p>Regards<br />Tony</p>
]]></description>
        	        	<pubDate>Wed, 07 Oct 2009 02:47:23 +0300</pubDate>
        </item>
        <item>
        	<title>HoSpiTaL_gHoSt on How to stretch columns</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10468</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/how-to-stretch-columns#p10468</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>I&#39;m using jqgrid 3.5.2 with shrinkToFit=false and I would like to keep it that way.&#160; My jqgrid is as wide as the webpage, and when the grid has a lot of columns, I get a horizontal scrollbar, which is what I want. My jqgrid resizes when I resize the window, and my column widths stay the same, which is also what I want.</p>
<p>Now the problem is that when I have very few columns, let&#39;s say 4, my grid is a lot wider than the total width of the 4 columns and it doesn&#39;t look very nice. I would like the columns to be stretched to fit the grid width ONLY when their total width &#60; grid width. Is this possible, and if so how?</p>
</p>
<p>Thanks in advance!</p>
]]></description>
        	        	<pubDate>Tue, 06 Oct 2009 08:49:09 +0300</pubDate>
        </item>
</channel>
</rss>