<?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: Select box is empty on the editform or addform</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/select-box-is-empty-on-the-editform-or-addform</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/select-box-is-empty-on-the-editform-or-addform/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>sokol on Select box is empty on the editform or addform</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/select-box-is-empty-on-the-editform-or-addform#p27473</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/select-box-is-empty-on-the-editform-or-addform#p27473</guid>
        	        	<description><![CDATA[<p>I made some changes and now data is displayed in the drop down but it is parsed vertically one letter at a time per line and displayed not only name and id but all the characters including ", {, R, O, W, S&#8230; so, either my javascript has some problem or to apply some json formatting in the cfc?</p>
</p>
<p>Data from cfc looks like this:</p>
</p>
<blockquote>
<p>{"ROWS":[{"id":"5_1","name":"ABC Company"},{"id":"10_2","name":"ABC Inc, Main Division"},{"id":"24_3","name":"Mines - Hourly Program"},{"id":"22_3","name":"Mines - Salaried Program"},{"id":"6_1","name":"Capital Realty"}]}</p>
</blockquote>
<p>I changed javascirpt since I already receive JSON to this:</p>
</p>
<blockquote>
<p>Old:</p>
<p>function(data) { &#160;<br />&#160;&#160;&#160; &#160;&#160;&#160;&#160; var response = typeof(data) === "string" ? jQuery.parseJSON(data.responseText): data;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8230;&#8230;&#8230;&#8230;</p>
</p>
<p>New:</p>
<p>function(response){&#8230;..&#160;</p>
</blockquote>
<p>I changed cfc to this:</p>
</p>
<blockquote>
<p>&#60;cffunction name="GetProvJ" access="remote" returnformat="json" returntype="struct" output="false"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfquery name="Lst" datasource="#REQUEST.dsn#" username="#REQUEST.dbusername#" password="#REQUEST.dbpassword#"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SELECT name, Convert(varchar(10),s.id) + &#39;_&#39; + Convert(varchar(10),s.account_id) AS id<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; FROM tblCompanies s<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE s.account_id = 1<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ORDER BY name<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/cfquery&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfset var arrTransactions = arrayNew(1)&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfloop query="Lst"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160; &#60;cfset returnStruct = StructNew() /&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfset returnStruct["name"] = name /&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;cfset returnStruct["id"] = id /&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;cfset ArrayAppend(VARIABLES.arrTransactions,returnStruct) /&#62;<br />&#160;&#160; &#160;&#160; &#60;/cfloop&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160; &#60;cfset strReturn = {rows=arrTransactions}&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160; &#60;cfreturn strReturn&#62;</p>
<p>&#60;/cffunction&#62;</p>
</blockquote>
]]></description>
        	        	<pubDate>Wed, 03 Oct 2012 17:13:40 +0300</pubDate>
        </item>
        <item>
        	<title>sokol on Select box is empty on the editform or addform</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/select-box-is-empty-on-the-editform-or-addform#p27467</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/select-box-is-empty-on-the-editform-or-addform#p27467</guid>
        	        	<description><![CDATA[<p>Hi</p>
<p>Could anyone check what is wrong with my code? When I bring edit or add form the select box that should be populated displays Error. I am trying to display list of companies in drop down list on edit and addform.</p>
</p>
<p>This is data from cfc action proc shown in firebug:</p>
<blockquote>
<p>{"ROWS":[["5_1","ABC Company"],["10_2","Main Division"],["24_3","Mines - Hourly Program"],["22_3","Mines - Salaried Program"],["6_1","First Capital"]]}</p>
</blockquote>
<p>jqGid:</p>
<blockquote>
<p>{name:&#39;description&#39;,index:&#39;description&#39;, width:150, sorttype:"text",editable:true,searchoptions:{sopt:[&#39;eq&#39;,&#39;lt&#39;,&#39;le&#39;,&#39;gt&#39;,&#39;ge&#39;]},edittype:"select",<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editoptions:{dataUrl:myURL + &#39;?method=GetProvJ&#39;,<br />&#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;&#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;buildSelect: &#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;&#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;function(data) { &#160;<br />&#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;var response = typeof(data) === "string" ? jQuery.parseJSON(data.responseText): data;&#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; &#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;&#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;var s = &#39;&#60;select&#62;&#39;; &#160;<br />&#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;if (response &#38;&#38; response.length) { &#160;<br />&#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;for (var i = 0, l=response.length; i&#60;l; i++) { &#160; <br />&#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;s += &#39;&#60;option value="&#39;+response[i]+&#39;"&#62;&#39;+response[i]+&#39;&#60;/option&#62;&#39;; &#160;<br />&#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;&#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;&#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;else<br />&#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;s += &#39;&#60;option value="0&#8243;&#62;Error&#60;/option&#62;&#39;; <br />&#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;&#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;return s + "&#60;/select&#62;"; &#160;<br />&#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;&#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;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;editrules:{required:true},<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;formoptions:{elmprefix:"(*)"}},</p>
</p>
</blockquote>
<p>CFC:</p>
</p>
<blockquote>
<p>&#60;cffunction name="GetProvJ" access="remote" returnformat="json" output="false"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfquery name="Lst" datasource="#REQUEST.dsn#" username="#REQUEST.dbusername#" password="#REQUEST.dbpassword#"&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SELECT TOP 2 name, Convert(varchar(10),s.my_id) + &#39;_&#39; + Convert(varchar(10),s.account_id) AS id<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; FROM tblCompanies s<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE account_id = 1&#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; ORDER BY name<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;/cfquery&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfset var arrTrans = arrayNew(1)&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfset var i = 1&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfloop query="Lst"&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;cfset VARIABLES.arrTrans[i] = [#id#,#name#]&#62;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#60;cfset i = i + 1&#62;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#60;/cfloop&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfset strReturn = {rows=arrTrans}&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160; &#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;cfreturn strReturn&#62;<br />&#160;&#160;&#160; &#60;/cffunction&#62;</p>
</blockquote>
]]></description>
        	        	<pubDate>Tue, 02 Oct 2012 23:18:25 +0300</pubDate>
        </item>
</channel>
</rss>