<?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: Double Click Column Separator</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator</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/feature-request/double-click-column-separator/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>kobruleht on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26152</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26152</guid>
        	        	<description><![CDATA[<blockquote>
<p>&#62;Should be doable, just insert a button somewhere, (will be easier in the footer), and iterate across the columns from left to right. Post your code here for me when you get it working. <img class="spSmiley" style="margin:0" title="Wink" src="http://www.trirand.com/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
<p>My grid dont have footer. It has top level toolbar and muliti-select checkbox column. VFP grid I&#39;m using does this on double click in first column header. In jqgrid multi select column header contaisn checkbox, not sure if it is reasonable to enable double click for this there.</p>
<p>Maybe use double click in some other place or add separate button in toolbar.</p>
<p>I van add button but do&#39;nt have&#160;enough js/jqgrid knowledge to use your code for this.</p>
</blockquote>
]]></description>
        	        	<pubDate>Thu, 15 Mar 2012 09:26:15 +0200</pubDate>
        </item>
        <item>
        	<title>Rat on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26149</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26149</guid>
        	        	<description><![CDATA[<blockquote>
<p><span style="color: #808080;"><em>Got it working (missed div). Thanks.</em>&#160;</span></p>
</blockquote>
<p>Sorry my bad&#8230; I should have explicitly stated that you needed to place an invisible div somewhere &#160;on your page as per below:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7816' value='Select Code' data-codeid='sfcode7816' /></p>
<div class='sfcode' id='sfcode7816'>&#60;div id=&#34;stringWidth&#34; style=&#34;display: none;&#34;&#62;&#60;/div&#62;</div>
</p>
<blockquote>
<p><em><span style="color: #808080;">How to align all columns in grid? e.q double click somewhere in first column header should resize all columns.</span></em></p>
</blockquote>
<p>Should be doable, just insert a button somewhere, (will be easier in the footer), and iterate across the columns from left to right. Post your code here for me when you get it working. <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
</p>
<p>p.s. Feel free to tidy up my cludgy code&#8230;</p>
]]></description>
        	        	<pubDate>Thu, 15 Mar 2012 01:50:42 +0200</pubDate>
        </item>
        <item>
        	<title>kobruleht on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26108</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26108</guid>
        	        	<description><![CDATA[<p>Got it working (missed div). Thanks.</p>
<p>How to align all columns in grid? e.q double click somewhere in first column header should resize all columns.</p>
]]></description>
        	        	<pubDate>Sat, 10 Mar 2012 17:11:39 +0200</pubDate>
        </item>
        <item>
        	<title>Rat on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26107</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26107</guid>
        	        	<description><![CDATA[<blockquote>
<p>kobruleht said:</p>
<p>It sets column width to very small. After that also column cannot resized.</p>
</blockquote>
<hr />
<p>Really? &#160;It works here... &#160;Do you have any data in the column? What UI style theme are you using?</p>
]]></description>
        	        	<pubDate>Sat, 10 Mar 2012 02:35:26 +0200</pubDate>
        </item>
        <item>
        	<title>kobruleht on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26104</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26104</guid>
        	        	<description><![CDATA[<p>It sets column width to very small. After that also column cannot resized.</p>
]]></description>
        	        	<pubDate>Fri, 09 Mar 2012 18:45:05 +0200</pubDate>
        </item>
        <item>
        	<title>Rat on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26102</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p26102</guid>
        	        	<description><![CDATA[<p>Here&#39;s some fully working code... its a bit messy but functional. I adapted it from the jqGrid&#39;s dragEnd event handler.</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4731' value='Select Code' data-codeid='sfcode4731' /></p>
<div class='sfcode' id='sfcode4731'>
<p>jQuery(&#39;span.ui-jqgrid-resize&#39;).dblclick(function ()</p>
<p>{</p>
<p>var id = jQuery(this).parent().attr(&#39;id&#39;);  // First get the ID of the column that this separator belongs to. This is a tag with an ID for the column.</p>
<p>var colName = id.split(&#39;_&#39;)[1];</p>
</p>
<p>var testDiv = jQuery(&#39;#stringWidth&#39;);  // Test DIV for measuring string widths</p>
</p>
<p>testDiv.addClass(&#39;ui-jqgrid ui-jqgrid-htable ui-jqgrid-sortable ui-th-column ui-state-hover ui-widget-content ui-widget-header ui-state-focus&#39;);  // Assign jqGrid header style classes</p>
<p>var padding = parseInt(jQuery(jQuery(this).parent()).css(&#39;padding-left&#39;)) + parseInt(jQuery(jQuery(this).parent()).css(&#39;padding-right&#39;));  // Calculate jqGrid header padding</p>
<p>testDiv.html(jQuery(jQuery(this).parent()).html());  // Assign jqGrid header text to test DIV</p>
<p>var nw = testDiv.width() + padding;  // Calculate jqGrid header text width</p>
</p>
<p>testDiv.removeClass(&#39;ui-jqgrid ui-jqgrid-htable ui-jqgrid-sortable ui-th-column ui-state-hover ui-widget-content ui-widget-header ui-state-focus&#39;);  // De-assign jqGrid header style classes</p>
<p>testDiv.addClass(&#39;ui-jqgrid ui-row-ltr jqgrow ui-widget-content&#39;);  // Assign jqGrid cell style classes</p>
</p>
<p>jQuery.each (jQuery(&#39;td[aria-describedby=&#39; + id + &#39;]&#39;), function()  // Iterate over all of the rows and figure out which row is the widest.</p>
<p>{</p>
<p>padding = parseInt(jQuery(this).css(&#39;padding-left&#39;)) + parseInt(jQuery(this).css(&#39;padding-right&#39;));  // Calculate jqGrid cell padding</p>
<p>testDiv.html(jQuery(this).html());  // Assign jqGrid cell text to test DIV</p>
<p>w = testDiv.width() + padding;  // Calculate jqGrid cell text width</p>
<p>if (w &#62; nw) {nw = w;}</p>
<p>});</p>
</p>
<p>// Code below adapted from the grid&#39;s &#34;dragEnd&#34; event handler</p>
<p>var ts = jQuery(&#39;#grid&#39;)[0];</p>
<p>var grid = ts.grid;</p>
<p>var p = ts.p;</p>
<p>var idx = jQuery.jgrid.getCellIndex(jQuery(this).parent());</p>
</p>
<p>jQuery(&#34;#rs_m&#34;+jQuery.jgrid.jqID(p.id)).css(&#34;display&#34;,&#34;none&#34;);</p>
</p>
<p>p.colModel[idx].width = nw;</p>
</p>
<p>grid.headers[idx].width = nw;</p>
<p>grid.headers[idx].el.style.width = nw + &#34;px&#34;;</p>
<p>grid.cols[idx].style.width = nw+&#34;px&#34;;</p>
<p>if(grid.footers.length&#62;0) {grid.footers[idx].style.width = nw+&#34;px&#34;;}</p>
</p>
<p>if(p.forceFit===true)</p>
<p>{</p>
<p>nw = grid.headers[idx+p.nv].newWidth &#124;&#124; grid.headers[idx+p.nv].width;</p>
<p>grid.headers[idx+p.nv].width = nw;</p>
<p>grid.headers[idx+p.nv].el.style.width = nw + &#34;px&#34;;</p>
<p>grid.cols[idx+p.nv].style.width = nw+&#34;px&#34;;</p>
<p>if(grid.footers.length&#62;0) {grid.footers[idx+p.nv].style.width = nw+&#34;px&#34;;}</p>
<p>p.colModel[idx+p.nv].width = nw;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>jQuery(&#39;table:first&#39;,grid.bDiv).css(&#34;width&#34;,p.tblwidth+&#34;px&#34;);</p>
<p>jQuery(&#39;table:first&#39;,grid.hDiv).css(&#34;width&#34;,p.tblwidth+&#34;px&#34;);</p>
<p>grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;</p>
<p>if(p.footerrow)</p>
<p>{</p>
<p>jQuery(&#39;table:first&#39;,grid.sDiv).css(&#34;width&#34;,p.tblwidth+&#34;px&#34;);</p>
<p>grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;</p>
<p>}</p>
<p>}</p>
<p>});</p>
</div>
]]></description>
        	        	<pubDate>Fri, 09 Mar 2012 07:07:21 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17803</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17803</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks for the work.</p>
<p>To work this a lot of other thing should be done. Since we work on grouping and there are a lot of changes in the structure I will try to provide a method like setColWidth - which will do the job for you, but this will happen after 2 moths maximum</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 08 Jun 2010 15:24:07 +0300</pubDate>
        </item>
        <item>
        	<title>squid on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17706</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17706</guid>
        	        	<description><![CDATA[<p>So this worked a little better. &#160;I created an invisible DIV in my document and then used it to determine the width of strings. &#160;Not "optimal" I guess, but it worked. &#160;Here&#39;s the code now. &#160;Note that I still have the issue with the drag handle doing odd things after the columns are resized.</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9654' value='Select Code' data-codeid='sfcode9654' /></p>
<div class='sfcode' id='sfcode9654'>
<pre>$(&#39;span.ui-jqgrid-resize&#39;).dblclick(function () {
	//
	// First get the ID of the column that this separator belongs to.
	// This is a  tag with an ID for the column.
	//
	id = $(this).parent ().attr (&#39;id&#39;);

	//
	// Get the text of the column header and compute its width.  Adding
	// 32 pixels to adjust for the potential sort icon for the column.
	//
	$(&#39;#stringWidth&#39;).html ($(this).next ().html ());
	width = $(&#39;#stringWidth&#39;).width () + 32;

	//
	// Iterate over all of the rows and figure out which row is the
	// longest.
	//
	$.each ($(&#39;td[aria-describedby=&#39; + id + &#39;]&#39;), function () {
		$(&#39;#stringWidth&#39;).html ($(this).html ());
		w = $(&#39;#stringWidth&#39;).width ();
		if (w &#62; width) {
			width = w;
		}
	});

	//
	// Now that we&#39;ve found the largest string in pixels, set the
	// header column to that width and also the first row&#39;s data column
	// width as well.
	//
	$(this).parent ().width (width);
	$(&#39;td[aria-describedby=&#39; + id + &#39;]&#39;).width (width);
});

</pre>
</div>
]]></description>
        	        	<pubDate>Thu, 03 Jun 2010 04:25:58 +0300</pubDate>
        </item>
        <item>
        	<title>squid on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17705</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17705</guid>
        	        	<description><![CDATA[<p>The other part that is odd is the actual column drag span. &#160;Although it gets moved to the correct spot (as specified by the &#39;width&#39; variable), when you go to actually DRAG it, it drags from the spot it was at PRIOR to resizing the column. &#160;Probably some internal data structure that holds its current position or something like that.</p>
]]></description>
        	        	<pubDate>Thu, 03 Jun 2010 03:23:18 +0300</pubDate>
        </item>
        <item>
        	<title>squid on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17704</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17704</guid>
        	        	<description><![CDATA[<p>So I decided it would be "fun" (yah, fun in a sick sort of way) to try and implement this. &#160;CAUTION: &#160;This code DOES NOT WORK YET, but it&#39;s a start&#8230; a damned good one, but I can&#39;t figure out how to get the length of a string in pixels.</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5487' value='Select Code' data-codeid='sfcode5487' /></p>
<div class='sfcode' id='sfcode5487'>
<pre>$(&#39;span.ui-jqgrid-resize&#39;).dblclick(function () {
	//
	// First get the ID of the column that this separator belongs to.
	// This is a  tag with an ID for the column.
	//
	id = $(this).parent ().attr (&#39;id&#39;);
	width = 0;

	//
	// Iterate over all of the rows and figure out which row is the
	// longest.
	//
	$.each ($(&#39;td[aria-describedby=&#39; + id + &#39;]&#39;), function () {
		inside = $(this).html ();

		//
		// find the width of the text and see if it&#39;s larger than the
		// current maximum width.
		//
		width = 100; // &#60;--- hack
	});

	//
	// Now that we&#39;ve found the largest string in pixels, set the
	// header column to that width and the first column in the data
	// row to that width as well.
	//
	$(this).parent ().width (width);
	$(&#39;td[aria-describedby=&#39; + id + &#39;]&#39;).width (width);
});
</pre>
</div>
]]></description>
        	        	<pubDate>Thu, 03 Jun 2010 03:19:11 +0300</pubDate>
        </item>
        <item>
        	<title>squid on Double Click Column Separator</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17702</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/double-click-column-separator#p17702</guid>
        	        	<description><![CDATA[<p>A good feature would be implementing a doubleclick handler for column separators that would automatically expand the column to the left of the separator to the width of the text of the widest row for that particular column. &#160;You can see this functionality in Excel when you type very long text in a cell, then doubleclick the column separator.</p>
]]></description>
        	        	<pubDate>Thu, 03 Jun 2010 01:27:56 +0300</pubDate>
        </item>
</channel>
</rss>