<?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: Toolbar + DatePicker</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/toolbar-datepicker</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/toolbar-datepicker/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>kheang on Toolbar + DatePicker</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/toolbar-datepicker#p19276</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/toolbar-datepicker#p19276</guid>
        	        	<description><![CDATA[</p>
<p>Ok so I found a way to get this working.</p>
<p>Not sure if my method is the best way, but it seems to work for me.</p>
<p>Here&#39;s what I have done for those of you interested.</p>
</p>
<p>In grid.custom.js I have added the following:</p>
</p>
<p>Near&#160;</p>
<p>filterToolbar : function(p){<span style="white-space: pre;"> </span>- line 518</p>
<p>I have opened another case and called mine "daterange"</p>
<p>I have put this code:&#160;</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8746' value='Select Code' data-codeid='sfcode8746' /></p>
<div class='sfcode' id='sfcode8746'>
<p>// START - DATE RANGE</p>
<p>case &#39;daterange&#39;:</p>
<p><span style=&#34;white-space: pre;&#34;> </span>v = $(&#34;input[name=&#34;+nm+&#34;_start_date]&#34;,$t.grid.hDiv).val();</p>
<p><span style=&#34;white-space: pre;&#34;> </span>if(v) {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>sdata[nm+&#34;_start_date&#34;] = v;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>sopt[nm+&#34;_start_date&#34;] = so;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>j++;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>} else {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>try {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>delete $t.p.postData[nm+&#34;_start_date&#34;];</p>
<p><span style=&#34;white-space: pre;&#34;> </span>} catch (e) {}</p>
<p><span style=&#34;white-space: pre;&#34;> </span>}</p>
</p>
<p><span style=&#34;white-space: pre;&#34;> </span>v = $(&#34;input[name=&#34;+nm+&#34;_end_date]&#34;,$t.grid.hDiv).val();</p>
<p><span style=&#34;white-space: pre;&#34;> </span>if(v) {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>sdata[nm+&#34;_end_date&#34;] = v;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>sopt[nm+&#34;_end_date&#34;] = so;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>j++;</p>
<p><span style=&#34;white-space: pre;&#34;> </span>} else {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>try {</p>
<p><span style=&#34;white-space: pre;&#34;> </span>delete $t.p.postData[nm+&#34;_end_date&#34;];</p>
<p><span style=&#34;white-space: pre;&#34;> </span>} catch (e) {}</p>
<p><span style=&#34;white-space: pre;&#34;> </span>}<br /><span style=&#34;white-space: pre;&#34;> </span>break;</p>
<p>// END - DATE RANGE</p>
</div>
<p>Near line 653 in the clearToolbar portion I have put another case "daterange":</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit858' value='Select Code' data-codeid='sfcode858' /></p>
<div class='sfcode' id='sfcode858'>
<p>// START - DATE RANGE</p>
<p>case &#39;daterange&#39;:</p>
<p>$(&#34;input[name=&#34;+nm+&#34;_start_date]&#34;,$t.grid.hDiv).val(v);</p>
<p>if(v) {</p>
<p>sdata[nm+&#34;_start_date&#34;] = v;</p>
<p>j++;</p>
<p>} else {</p>
<p>try {</p>
<p>delete $t.p.postData[nm+&#34;_start_date&#34;];</p>
<p>} catch (e){}</p>
<p>}</p>
</p>
<p>$(&#34;input[name=&#34;+nm+&#34;_end_date]&#34;,$t.grid.hDiv).val(v);</p>
<p>if(v) {</p>
<p>sdata[nm+&#34;_end_date&#34;] = v;</p>
<p>j++;</p>
<p>} else {</p>
<p>try {</p>
<p>delete $t.p.postData[nm+&#34;_end_date&#34;];</p>
<p>} catch (e){}</p>
<p>}</p>
<p>break;</p>
<p>// END - DATE RANGE</p>
</div>
<p>And on line 854 right after the last case "text" for the stype I have put another case "daterange" with the code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9471' value='Select Code' data-codeid='sfcode9471' /></p>
<div class='sfcode' id='sfcode9471'>
<p>// START DATE RANGE</p>
<p>case &#39;daterange&#39;:</p>
<p>var df = soptions.defaultValue ? soptions.defaultValue: &#34;&#34;;</p>
<p>$(thd).append(&#34;&#60;input type=&#39;text&#39; style=&#39;width:40%;padding:0;margin-right:5px;&#39; name=&#39;&#34;+(cm.index &#124;&#124; cm.name)+&#34;_start_date&#39; id=&#39;gs_&#34;+cm.name+&#34;_start_date&#39; value=&#39;&#34;+df+&#34;&#39;/&#62;&#34;);</p>
<p>if(soptions.attr) {$(&#34;input&#34;,thd).attr(soptions.attr);}</p>
<p>if(soptions.dataInit !== undefined) { soptions.dataInit($(&#34;input&#34;,thd)[0]); }</p>
<p>if(soptions.dataEvents !== undefined) { bindEvents($(&#34;input&#34;,thd)[0], soptions.dataEvents); }</p>
<p>if(p.autosearch===true){</p>
<p>if(p.searchOnEnter) {</p>
<p>$(&#34;input&#34;,thd).keypress(function(e){</p>
<p>var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;</p>
<p>if(key == 13){</p>
<p>triggerToolbar();</p>
<p>return false;</p>
<p>}</p>
<p>return this;</p>
<p>});</p>
<p>} else {</p>
<p>$(&#34;input&#34;,thd).keydown(function(e){</p>
<p>var key = e.which;</p>
<p>switch (key) {</p>
<p>case 13:</p>
<p>return false;</p>
<p>case 9 :</p>
<p>case 16:</p>
<p>case 37:</p>
<p>case 38:</p>
<p>case 39:</p>
<p>case 40:</p>
<p>case 27:</p>
<p>break;</p>
<p>default :</p>
<p>if(timeoutHnd) { clearTimeout(timeoutHnd); }</p>
<p>timeoutHnd = setTimeout(function(){triggerToolbar();},500);</p>
<p>}</p>
<p>});</p>
<p>}</p>
<p>}</p>
</p>
<p>var df = soptions.defaultValue ? soptions.defaultValue: &#34;&#34;;</p>
<p>$(thd).append(&#34;&#60;input type=&#39;text&#39; style=&#39;width:40%;padding:0px;&#39; name=&#39;&#34;+(cm.index &#124;&#124; cm.name)+&#34;_end_date&#39; id=&#39;gs_&#34;+cm.name+&#34;_end_date&#39; value=&#39;&#34;+df+&#34;&#39;/&#62;&#34;);</p>
<p>if(soptions.attr) {$(&#34;input&#34;,thd).attr(soptions.attr);}</p>
<p>if(soptions.dataInit !== undefined) { soptions.dataInit($(&#34;input&#34;,thd)[1]); }</p>
<p>if(soptions.dataEvents !== undefined) { bindEvents($(&#34;input&#34;,thd)[1], soptions.dataEvents); }</p>
<p>if(p.autosearch===true){</p>
<p>if(p.searchOnEnter) {</p>
<p>$(&#34;input&#34;,thd).keypress(function(e){</p>
<p>var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;</p>
<p>if(key == 13){</p>
<p>triggerToolbar();</p>
<p>return false;</p>
<p>}</p>
<p>return this;</p>
<p>});</p>
<p>} else {</p>
<p>$(&#34;input&#34;,thd).keydown(function(e){</p>
<p>var key = e.which;</p>
<p>switch (key) {</p>
<p>case 13:</p>
<p>return false;</p>
<p>case 9 :</p>
<p>case 16:</p>
<p>case 37:</p>
<p>case 38:</p>
<p>case 39:</p>
<p>case 40:</p>
<p>case 27:</p>
<p>break;</p>
<p>default :</p>
<p>if(timeoutHnd) { clearTimeout(timeoutHnd); }</p>
<p>timeoutHnd = setTimeout(function(){triggerToolbar();},500);</p>
<p>}</p>
<p>});</p>
<p>}</p>
<p>}</p>
<p>break;</p>
<p>// END DATE RANGE</p>
</div>
<p>To use it I put this in the column configuration:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2964' value='Select Code' data-codeid='sfcode2964' /></p>
<div class='sfcode' id='sfcode2964'>
<p>search: true,</p>
<p>stype: &#34;daterange&#34;,</p>
<p>searchoptions: {</p>
<p>dataInit: function (elem) {</p>
<p>$(elem).datepicker({ dateFormat: &#34;yy-mm-dd&#34; });</p>
<p>},</p>
<p>dataEvents: [</p>
<p>{</p>
<p>type: &#34;change&#34;,</p>
<p>fn: function(e){</p>
<p>$(&#34;#list&#34;)[0].triggerToolbar();</p>
<p>}</p>
<p>}</p>
<p>],</p>
<p>attr: {</p>
<p>title:&#34;Select Date&#34;</p>
<p>}</p>
<p>},</p>
</div>
<p>What it basically does it add 2 input fields with the same code as text case but instead appends at the end of the name _start_date and _end_date. And when I do my searches, I look for the column_start_date and column_end_date.&#160;</p>
<p>Mind you I haven&#39;t fully tested this. It works for me when I do searches, but I haven&#39;t used it with all the toolbar search methods you can do. I use the easy method where I just grab the submitted data and do my own comparisons without using any of the parameters available.</p>
<p>I am always open for a better solution on this. I don&#39;t recommend anyone using this work around that I am using.&#160;</p>
]]></description>
        	        	<pubDate>Tue, 24 Aug 2010 17:58:37 +0300</pubDate>
        </item>
        <item>
        	<title>kheang on Toolbar + DatePicker</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/toolbar-datepicker#p19274</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/toolbar-datepicker#p19274</guid>
        	        	<description><![CDATA[<p>Hi,</p>
</p>
<p>Just to say that I love your jqgrid, I think it is pretty awesome work!</p>
</p>
<p>I was wondering is there an easy way to implement datepicker in the toolbar but for a range?</p>
<p>If I wanted to search start_date - end_date ?</p>
</p>
<p>I tried searching but couldn&#39;t find anything about multiple dates in the toolbar.</p>
</p>
<p>Thanks!</p>
]]></description>
        	        	<pubDate>Tue, 24 Aug 2010 16:31:47 +0300</pubDate>
        </item>
</channel>
</rss>