View Full Version : grid data showing &pos;

14 Sep 2010, 10:48 AM

i have a data stored in database with an apostrophe e.g. Child's Data - which is read via a store into a grid and displays fine.

on double clicking a row in the grid my code gets the data out of the grid and places it in a form. However when it shows this data in a textfield it shows it as Child's Data

// code to get the value
var getSelectedData = livegrid.getSelectionModel().getSelections();
var selectedRow = getSelectedData[0];

// then in text field
value: selectedRow.get('VIEWNAME')

been searching for ages on how to rectify this and i am sure its something simple. would appreciate some help

15 Sep 2010, 4:28 AM
I suggest to use convert method on your store for your fields !

fields: [
}, {
name: 'VIEWNAME',
convert: function (v) {
v = String(v).replace(/é/g,'').replace(/è/g,'')...; // make all transformations that you need
return v;

But the best solution, is to send data form server without html convert !

16 Sep 2010, 3:27 AM
thanks that worked perfect :)

however, we are now noticing that the Ext.ux.grid.GridFilters that we have applied to the column are not finding the value if we search for the apostrpohe '

16 Sep 2010, 3:32 AM
what is apostrpohe's format into your database ?

ps: becarefull, if you using html viewer for watching database, you can see only convert result => switch on edit mode !

16 Sep 2010, 4:48 AM
thanks, what is the edit mode?

the problem relates to using the apostophe in the select statement. the following details this problem...

we are running a cfquery with the following sql statement:

SELECT viewname, categoryname FROM views LEFT OUTER JOIN viewcategories on views.categoryid = viewcategories.categoryid GROUP BY viewname HAVING categoryname IN ("aaaa's") ORDER BY viewname ASC LIMIT 0, 300

if we type this directly into mysql it works fine, similarly if we type it directly into a <cfquery> it works fine. however the having clause is getting built from following code and is causing the problem:

<cfset value = arraynew(1) />
<cfset value[1] = "aaaa's" />
<cfloop index="a" from="1" to="#arraylen(value)#">
<cfset value[a] = '"#value[a]#"' />
<cfset havingClause = "HAVING categoryname IN (#arraytolist(value)#)" />

the problem is occuring due to the apostrophe '. we have tried coldfusion preserveSingleQuotes function but still does not work.

do you see any way around this?