<?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: editData works with a test varaible, but not with form variables</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables</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/editdata-works-with-a-test-varaible-but-not-with-form-variables/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>creativeflood on editData works with a test varaible, but not with form variables</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27814</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27814</guid>
        	        	<description><![CDATA[<p>This magically started working. Thanks anyway.</p>
]]></description>
        	        	<pubDate>Fri, 30 Nov 2012 05:05:44 +0200</pubDate>
        </item>
        <item>
        	<title>creativeflood on editData works with a test varaible, but not with form variables</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27811</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27811</guid>
        	        	<description><![CDATA[<p>I really need help on this one. I&#39;ll PayPal someone $5 for a beer to get the right answer. Spent a day on it! Thanks!</p>
]]></description>
        	        	<pubDate>Thu, 29 Nov 2012 23:42:49 +0200</pubDate>
        </item>
        <item>
        	<title>creativeflood on editData works with a test varaible, but not with form variables</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27810</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/editdata-works-with-a-test-varaible-but-not-with-form-variables#p27810</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a drop down list outside of the jqgrid. When toggled this grid sets an ID with populates the Jqgrid. This works fine and so does editing in the dialog box. The problem arises when I try to add a new row. I use editData to send the DistrictID, however the value is always empty. If I hard code a number in then editData works, so it has something to do with reading the form value. I am new to jqgrid, so would really appreciate the help. Here is the code (noted where only a hardcoded number works and the form field fails):</p>
</p>
<p>&#60;p&#62;District Name: @Html.DropDownListFor(m =&#62; m.DistrictDirectorID, new SelectList(Model.DistrictList, "Value", "Text"), "-----Choose One-----")<br />@Html.ValidationMessage("DistrictDirectorID")&#60;/p&#62;</p>
<p>&#60;table id="list" class="scroll" cellpadding="0" cellspacing="0" style="display:none;"&#62;&#60;/table&#62;<br />&#160;&#160;&#160; &#60;div id="listPager" class="scroll" style="text-align:center;"&#62;&#60;/div&#62;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; &#60;div id="listPsetcols" class="scroll" style="text-align:center;"&#62;&#60;/div&#62; </p>
<p>&#60;script type="text/javascript"&#62;</p>
<p>&#160;&#160;&#160; $(document).ready(function () {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#DistrictDirectorID&#39;).change(function () {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var selectedID = $("#DistrictDirectorID").val();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (selectedID &#62; 0) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#list").setGridParam({ postData: { id: $("#DistrictDirectorID").val()} }).trigger("reloadGrid");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#list&#39;).show();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;#list&#39;).hide();<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; var updateDialog = {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &#39;/AnnualReport/Section1/Update/&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editData: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; DistrictDirectorID: function () { return $("#DistrictDirectorID option:selected").val(); } //here is where it fails to send unless hardcoded<br />&#160;&#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; closeAfterAdd: true<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , closeAfterEdit: true<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , modal: true<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , onclickSubmit: function (params) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ajaxData = {};</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var list = $("#list");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var selectedRow = list.getGridParam("selrow");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowData = list.getRowData(selectedRow);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ajaxData = { StudentDemographicId: rowData.StudentDemographicId, DistrictDirectorID: $("#DistrictDirectorID option:selected").val() };</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return ajaxData;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , width: "450"<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; };</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.nav.addtext = "Add";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.nav.edittext = "Edit";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.nav.deltext = "Delete";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.edit.addCaption = "Add Contact";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.edit.editCaption = "Edit Contact";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.del.caption = "Delete Contact";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.jgrid.del.msg = "Delete selected Contact?";<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#list").jqGrid({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: &#39;/AnnualReport/Section1/List/&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; postData: {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; id: function () { return $("#DistrictDirectorID option:selected").val(); }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; datatype: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mtype: &#39;GET&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colNames: [&#39;StudentDemographicId&#39;, &#39;DistrictDirectorID&#39;, &#39;Targeted School&#39;],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; colModel: [<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;StudentDemographicId&#39;, index: &#39;StudentDemographicId&#39;, width: 40, align: &#39;left&#39;,&#160; key: true,editable: true, editrules: { edithidden: false }, hidedlg: true, hidden: true },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;DistrictDirectorID&#39;, index: &#39;DistrictDirectorID&#39;, width: 40, align: &#39;left&#39;,&#160; key: true,editable: true, editrules: { edithidden: false }, hidedlg: true, hidden: true },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { name: &#39;TargetedSchool&#39;, index: &#39;TargetedSchool&#39;, width: 350, align: &#39;left&#39;, editable: true, edittype: &#39;text&#39;, editrules: { required: true }, formoptions: { elmsuffix: &#39; *&#39;} },<br />&#160;&#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; pager: $(&#39;#listPager&#39;),<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowNum: 30,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rowList: [1000],<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortname: &#39;StudentDemographicId&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sortorder: "desc",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; caption: &#39;Contact List&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; autowidth: true,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ondblClickRow: function (rowid, iRow, iCol, e) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#list").editGridRow(rowid, prmGridDialog);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }).navGrid(&#39;#listPager&#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;&#160;&#160;&#160;&#160; edit: true, add: true, del: true, search: false, refresh: true</p>
<p>&#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; updateDialog,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; updateDialog,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; updateDialog<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; );<br />&#160;&#160;&#160; });&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160; &#60;/script&#62;</p>
<p>Thanks!</p>
<p>Dan</p></p>
]]></description>
        	        	<pubDate>Thu, 29 Nov 2012 20:44:06 +0200</pubDate>
        </item>
</channel>
</rss>