<?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: progress bar cells</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells</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/progress-bar-cells/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26746</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26746</guid>
        	        	<description><![CDATA[<p>Someone on IRC suggested changing the sort order right after the grid is loaded. I found the code ".trigger(&#39;reloadGrid&#39;)" in a stackoverflow post, so I added that after the grid is resized after the data is loaded. That did the trick.</p>
<p><a href="http://jsfiddle.net/wavez/sMzYW/5/" target="_blank">http://jsfiddle.net/wavez/sMzYW/5/</a></p>
</p>
<p>Last line of code:</p>
<p>$("#reports"+i).jqGrid(&#39;setGridWidth&#39;,width,true).trigger(&#39;reloadGrid&#39;);</p>
</p>
<p><strong>I think this is kind of hack-ish, and I would really appreciate it if someone would actually reply to my thread and suggest a better solution. Thanks.</strong></p>
]]></description>
        	        	<pubDate>Thu, 07 Jun 2012 05:53:25 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26745</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26745</guid>
        	        	<description><![CDATA[<p>I&#39;m still having the issue that I can&#39;t figure out how to design this so that gridComplete() only calls once, both when the data is loaded, and when the sort order is changed on the grid.</p>
</p>
<p>Here is my code on jsfiddle. Instead of adding progress bars, I&#39;m appending an exclamation mark to the content of cells in the last column.</p>
<p><a href="http://jsfiddle.net/wavez/sMzYW/2/" target="_blank">http://jsfiddle.net/wavez/sMzYW/2/</a></p>
]]></description>
        	        	<pubDate>Thu, 07 Jun 2012 03:58:58 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26723</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26723</guid>
        	        	<description><![CDATA[<p>The problem is how the data is being loaded into the grid (I took this code from the demos since this was an easy place to start learning).</p>
</p>
<p>var mydata = [</p>
<p style="padding-left: 30px;">{name:"2", past:"300.00", present:"900.00", status:"&#60;div class="meter"&#62;320.0&#60;/div&#62;"},</p>
<p style="padding-left: 30px;">{name:"3", past:"400.00", present:"800.00", status:"&#60;div class="meter"&#62;430.0&#60;/div&#62;"},</p>
<p style="padding-left: 30px;">{name:"4", past:"200.00", present:"400.00", status:"&#60;div class="meter"&#62;210.0&#60;/div&#62;"},</p>
<p style="padding-left: 30px;">{name:"5", past:"300.00", present:"500.00", status:"&#60;div class="meter"&#62;320.0&#60;/div&#62;"},</p>
<p style="padding-left: 30px;">{name:"6", past:"400.00", present:"600.00", status:"&#60;div class="meter"&#62;430.0&#60;/div&#62;"},</p>
<p style="padding-left: 30px;">{name:"9", past:"400.00", present:"450.00", status:"&#60;div class="meter"&#62;100.0&#60;/div&#62;"}</p>
<p style="padding-left: 30px;">];</p>
</p>
<p style="padding-left: 30px;">for(var j=0; j&#60;=mydata.length; j++) { jQuery("#reports"+i).jqGrid(&#39;addRowData&#39;,j+1,mydata[j]) }</p>
<p>}</p>
<p>If someone could suggest another way to load the data so that I won&#39;t have this problem, that would be great.</p>
]]></description>
        	        	<pubDate>Mon, 04 Jun 2012 02:54:49 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26722</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26722</guid>
        	        	<description><![CDATA[<p>I changed to code to debug the issue. This is obviously the problem. I&#39;m not sure how to fix it yet.</p>
</p>
<p>gridComplete: function(){</p>
<p style="padding-left: 30px;">$(this).find("div.meter").each(function(){</p>
<p style="padding-left: 60px;">$(this).text($(this).text()+&#39; &#39;+i)</p>
<p style="padding-left: 30px;">})</p>
<p>},</p>
</p>
<p><a href="http://i.imgur.com/ltXwI.png" target="_blank"></a></p>
<blockquote class="imgur-embed-pub" lang="en" data-id="ltXwI">
<p><a href="https://imgur.com/ltXwI" target="_blank">View post on imgur.com</a></p>
</blockquote>
<p><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script></p>
]]></description>
        	        	<pubDate>Mon, 04 Jun 2012 02:36:16 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26712</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26712</guid>
        	        	<description><![CDATA[<p>Okay, so I realized there&#39;s more documentation that I haven&#39;t been finding. There&#39;s no index to navigate the methods and such?</p>
</p>
<p>I added this function to my grid:</p>
</p>
<p>gridComplete: function(rowid, rowdata, rowelem){</p>
<p style="padding-left: 30px;">$(this).find("div.meter").each(function(){</p>
<p style="padding-left: 60px;">$(this).text(&#39;&#39;).progressbar({ value: Math.floor(Math.random() * 100, 100) })</p>
<p style="padding-left: 30px;">})</p>
<p>},</p>
</p>
<p>The good news is that I get all my progress bars showing up when the sorting order is changed. The bad news is that only one of my progress bars are drawing correctly when the table is first created. Here&#39;s a screen shot:</p>
<p><a href="http://i.imgur.com/NNnqu.jpg" rel="nofollow" target="_blank"></a></p>
<blockquote class="imgur-embed-pub" lang="en" data-id="NNnqu">
<p><a href="https://imgur.com/NNnqu" target="_blank">View post on imgur.com</a></p>
</blockquote>
<p><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script></p>
]]></description>
        	        	<pubDate>Thu, 31 May 2012 13:13:25 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26708</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26708</guid>
        	        	<description><![CDATA[<p>Ya, I have to find a way to create the progress bar when pws_progressbar() is called, because when the user changes the sort order on the table, all the progress bars are destroyed because every row is destroyed and recreated. Since my custom function, pws_progressbar() only returns "&#60;div class=&#39;meter&#39;&#62;stuff is here&#60;/div&#62;", there is nothing to call jQuery.progressbar().</p>
</p>
<p>I can&#39;t figure out how to get Formatter to put the &#60;div&#62; tags in the cells and then call .progressbar().</p>
]]></description>
        	        	<pubDate>Thu, 31 May 2012 04:43:08 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26707</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26707</guid>
        	        	<description><![CDATA[<p>Okay, I kind of got it working. I have a question still though, so please look for that at the bottom in this reply.</p>
</p>
<p>I&#39;m using the Formatter to put a div into the cells in one column, and then I&#39;m calling .progressbar() on each of those divs. This is my colModel:</p>
</p>
<p>colModel:[</p>
<p style="padding-left: 30px;">{name:&#39;name&#39;, index:&#39;name&#39;, width:(0.1*width), align:"center", sorttype:"int", editable:false},</p>
<p style="padding-left: 30px;">{name:&#39;past&#39;, index:&#39;past&#39;, width:(0.15*width), align:"center", sorttype:"float", editable:false},</p>
<p style="padding-left: 30px;">{name:&#39;present&#39;, index:&#39;present&#39;, width:(0.15*width), align:"center", sorttype:"float", editable:true, edittype:&#39;custom&#39;, editoptions:{ custom_element:my_input, custom_value:my_value} },</p>
<p style="padding-left: 30px;">{name:&#39;status&#39;, index:&#39;status&#39;, width:(0.6*width), align:"center", sorttype:"float", editable:false, <strong>formatter:pws_progressbar</strong>&#160;}</p>
<p>],</p>
</p>
<p>And this is the function:</p>
<p>function pws_progressbar() {</p>
<p style="padding-left: 30px;">return "&#60;div class=&#39;meter&#39;&#62;stuff is here&#60;/div&#62;";</p>
<p>}</p>
</p>
<p>I have my jQuery().jqGrid({}) inside of $(document).ready(function() {______} );</p>
<p>After all of that, this part puts the progress bars on the page:</p>
<p>$(function(){</p>
<p style="padding-left: 30px;">$(".meter").each(function() {</p>
<p style="padding-left: 60px;">$(this).text("").progressbar({ value: Math.floor(Math.random() * 100, 100) })</p>
<p style="padding-left: 30px;">})</p>
<p>});</p>
</p>
<p>My question is, wouldn&#39;t it be better to put the progress bars on the page inside pws_progressbar()? And, how would I do that?</p>
]]></description>
        	        	<pubDate>Thu, 31 May 2012 03:46:37 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26706</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26706</guid>
        	        	<description><![CDATA[<p>Actually, the email function on line 5016 might be easier for me to start with. I&#39;m thinking all copy that function and change it to insert a div with a certain ID and class, and then I&#39;ll just create my progress bars from those on document ready. The code might be something like this:</p>
</p>
<p>$.fn.fmatter.progressbar = function(cellval, opts) {</p>
<p style="padding-left: 30px;">if(!$.fmatter.isEmpty(cellval)) {</p>
<p style="padding-left: 60px;">return "&#60;div class="progressbar" id="" + cellval + ""&#62;progress bar&#60;/div&#62;";</p>
<p style="padding-left: 30px;">}else {</p>
<p style="padding-left: 60px;">return $.fn.fmatter.defaultFormat(cellval,opts);</p>
<p style="padding-left: 30px;">}</p>
<p>};</p>
</p>
<p>It seems like I should be able to do something like <em>return $(.progressbar( { value: 37 }&#160;));</em></p>
<p>I have very little experience with both jQuery and JS though, and I don&#39;t know how to do this yet</p>
]]></description>
        	        	<pubDate>Thu, 31 May 2012 02:28:50 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26705</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26705</guid>
        	        	<description><![CDATA[<p>I am thinking that I will have to add a function in jquery.jqGrid.src.js. I&#39;m thinking that I can copy the code that adds a checkbox to a cell, and modify it to add a progress bar instead. From line 5023, I think this is the section I need:</p>
</p>
<p>function(cval, opts)</p>
<p>{</p>
<p style="padding-left: 30px;">var op = $.extend({},opts.checkbox), ds;</p>
<p style="padding-left: 30px;">if(!$.fmatter.isUndefined(opts.colModel.formatoptions)) {</p>
<p style="padding-left: 60px;">op = $.extend({},op,opts.colModel.formatoptions);</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">if(op.disabled===true) {ds = "disabled="disabled"";} else {ds="";}</p>
<p style="padding-left: 30px;">if($.fmatter.isEmpty(cval) &#124;&#124; $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);}</p>
<p style="padding-left: 30px;">cval=cval+"";cval=cval.toLowerCase();</p>
<p style="padding-left: 30px;">var bchk = cval.search(/(false&#124;0&#124;no&#124;off)/i)&#60;0 ? " checked=&#39;checked&#39; " : "";</p>
<p style="padding-left: 30px;">return "&#60;input type="checkbox" " + bchk  + " value=""+ cval+"" offval="no" "+ds+ "/&#62;";</p>
<p>};</p>
]]></description>
        	        	<pubDate>Thu, 31 May 2012 01:47:58 +0300</pubDate>
        </item>
        <item>
        	<title>wavez on progress bar cells</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26700</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/progress-bar-cells#p26700</guid>
        	        	<description><![CDATA[<p>I am working on a problem right now; I am wanting to put progress bars in one column on my grids. I have been able to do this with conventional tables and the jQuery progressbar object, but haven&#39;t figured out how to put those bars into a jqGrid.</p>
</p>
<p>I&#39;m using one of the demos as an example for adding custom elements to cells:</p>
<p>Navigate to <a title="trirand.com demos" href="/blog/jqgrid/jqgrid.html" target="_blank">trirand.com/&#160;demos</a>-&#62;"New in version 3.6&#8243;-&#62;"Create Custom input element".</p>
</p>
<p>In this demo, one method of injecting custom elements into the grid is shown. I was able to make this demo work for the intended edit-field feature, when a row is selected, but I haven&#39;t figured out how to turn one cell into a progress bar.</p>
</p>
<p>function pws_progressbar() {</p>
<p style="padding-left: 30px;">return $(this).progressbar({ value: Math.floor(Math.random() * 100, 100) });</p>
<p>}</p>
]]></description>
        	        	<pubDate>Wed, 30 May 2012 23:43:36 +0300</pubDate>
        </item>
</channel>
</rss>