Copy link to clipboard
Copied
Hi All -
I am using jquery jqgrid with Coldfusion. I have a cfc whose return format is JSON. I have a database column of type varchar, but it returns values which starts with zeroes. On displaying data, the leading zeroes are truncated. I verified in firebug, the JSON response itself is cutting off the leading zeroes.
Any suggestions or thoughts on this?
Copy link to clipboard
Copied
Make a test copy of your cfc. Start invoking it and dumping data until you can see the line of code that is stripping away your zeros.
Copy link to clipboard
Copied
I am actually just now having the same problem. I don't know of a good solution so I put in a conditional to add a space if the string starts with zero.
<cfif left(.getValue.value,1) EQ '0'>
<cfset arrayAppend(row["cell"], ' #local.getValue.value#')>
<cfelse>
<cfset arrayAppend(.row["cell"], local.getValue.value)>
</cfif>
Copy link to clipboard
Copied
If you are using CF 9.0 there was a documented bug that has been fixed in Adobe® ColdFusion® 9.0 Update 1:
ID | Area | Bug Description |
82706 | AJAX Plumbing | When you use serializeJSON or deserializeJSON, data type conversion occurs automatically. For example, 000001 is converted to numeric 1. |
I know that there are new bugs introduced with Updater 1 so it would probably be wise to get the ColdFusion 9.0.1 Cumulative Hot Fix 1 also. As always, test the updates before using in production.