<?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: jqGrid Time Management/Calendar Processor Development</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-time-managementcalendar-processor-development</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/jqgrid-time-managementcalendar-processor-development/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Exact on jqGrid Time Management/Calendar Processor Development</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/jqgrid-time-managementcalendar-processor-development#p23944</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/jqgrid-time-managementcalendar-processor-development#p23944</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I&#39;m working with jqGrid to develop a time management module for a customer. We have already deployed jqGrid extensively over the rest of the site so we&#39;re working to make it fit this role too.</p>
<p>We need to be able to display a column for each day of a calendar month, each day then being split into two columns for overtime worked (HV - text input box) and the reason (R - select dropdown). I&#39;ve got the grid designed to an extent (overtime/reason columns, list of branch staff etc) but am having trouble writing the processor. The code below shows what I currently have. This populates the grid (via another file) with a list of employees. The column list (day numbers 1-31) is generated from a PHP function which determines the current month and year. Grid.php then posts to gridsave.php when the row is clicked-off.</p>
<p>I would like to be able to determine which field has been edited as easily as possible. I do not want 62 columns (HV and R for each day of a 31 day month) in my database just in case, I&#39;d like to programmatically determine the field id (date) and store that in a date column using my processor. If at all possible, I&#39;d like to only pass modified fields to my processor to save on processing time.</p>
<p>Then, in reverse, I need to be able to extract this information (based on the date determined above) and input it into the correct column in jqGrid.</p>
<p>Needless to say I&#39;ve now come up against a brick wall and not sure how to proceed on any of the above so will have to bow to superior knowledge. I&#39;m not worried about validation of user input at this exact moment in time, I&#39;m just trying to determine if this will work in theory! Any assistance in this will be much appreciated..</p>
<p>grid.php</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1982' value='Select Code' data-codeid='sfcode1982' /></p>
<div class='sfcode' id='sfcode1982'>&#160;&#160;&#160; var lastsel2;<br />&#160;&#160;&#160; jQuery(document).ready(function(){ <br />&#160;&#160;&#160;&#160;&#160; jQuery(&#34;#timeLog&#34;).jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; url:&#39;datagrid.php?module=timemanagement&#38;branchid=&#60;?php echo($branchid); ?&#62;&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; editurl: &#34;gridsave.php?branchid=&#60;?php echo($branchid); ?&#62;&#34;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#39;GET&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames:[&#39;First Name&#39;,&#39;Surname&#39;,&#39;Job Title&#39;,&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;?php<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $x = 1;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; while($x &#60;= $numdays) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; echo(&#34;&#39;HV&#39;,&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; echo(&#34;&#39;R&#39;,&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $x++;<br />&#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; ?&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel :[ <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;firstname&#39;, index:&#39;firstname&#39;, align: &#39;center&#39;, width: 100, searchoptions: { sopt: [&#39;eq&#39;, &#39;ne&#39;, &#39;lt&#39;, &#39;gt&#39;, &#39;cn&#39;, &#39;nc&#39;]}}, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;lastname&#39;, index:&#39;lastname&#39;, align: &#39;center&#39;, width: 100, searchoptions: { sopt: [&#39;eq&#39;, &#39;ne&#39;, &#39;lt&#39;, &#39;gt&#39;, &#39;cn&#39;, &#39;nc&#39;]}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;jobtitle&#39;, index:&#39;jobtitle&#39;, align: &#39;center&#39;, width: 100, searchoptions: { sopt: [&#39;eq&#39;, &#39;ne&#39;, &#39;lt&#39;, &#39;gt&#39;, &#39;cn&#39;, &#39;nc&#39;]}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;?php<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $x = 1;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; while($x &#60;= $numdays) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; echo(&#34;{name:&#39;hv-$x-$month-$year&#39;, index:&#39;hv&#39;, align: &#39;center&#39;, width: 25, sortable: false, editable: true},&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; echo(&#34;{name:&#39;r-$x-$month-$year&#39;, index:&#39;r&#39;, align: &#39;center&#39;, width: 25, sortable: false, editable:true, edittype:&#39;select&#39;, editoptions:{value:&#39;:;OT:OT;S:S;H:H;OA:OA&#39;}},&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $x++;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ?&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; onSelectRow: function(id){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(id &#38;&#38; id!==lastsel2){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#timeLog&#39;).jqGrid(&#39;saveRow&#39;,lastsel2);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#timeLog&#39;).jqGrid(&#39;editRow&#39;,id,true);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lastsel2=id;<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; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; height: 500,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum:25,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList:[25,50,100],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;firstname&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: &#39;ASC&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160; }).navGrid(&#39;#pager&#39;, {search:true, edit: false, add:false, del:false});<br />&#160;&#160;&#160; });&#160;&#160;</div>
<p>&#160; &#160;</p>
<p>gridsave.php</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5246' value='Select Code' data-codeid='sfcode5246' /></p>
<div class='sfcode' id='sfcode5246'>// Check for exec permission<br />define(&#39;_CHECKEXEC&#39;, TRUE);</p>
<p>// Connect to database<br />include(&#34;./includes/init.inc.php&#34;);</p>
<p>if($_GET[&#39;oper&#39;] == &#34;edit&#34;) {<br />&#160;&#160;&#160; // Generate query and insert data<br />&#160;&#160;&#160; $sql = &#34;INSERT INTO tbltimemanagement(userid, hv, r) VALUES (&#39;$_POST[id]&#39;, &#39;$_POST[hv]&#39;, &#39;$_POST[r]&#39;);&#34;;<br />&#160;&#160;&#160; mysql_query($sql);<br />}</p>
</div>
]]></description>
        	        	<pubDate>Tue, 12 Jul 2011 21:35:15 +0300</pubDate>
        </item>
</channel>
</rss>