I am using extJS 2.1 in combo with ColdFusion MX7. I have a grid setup using the Ext.data.JsonStore as my data store, and it works fine on my local machine. I am running into a problem, however, when I move the code to my company's development server. The dev server is running a special version of ColdFusion MX7 which inserts the following line at the beginning of every html response:
This breaks the JsonStore's default reader. How would I go about setting up a custom reader which can use a regex to strip this line out of the html response?Thanks!Mike
Ext.override(Ext.data.JsonReader, {
read : function(response){
var json = response.responseText;
json = json.replace(/]*>/, "");
var o = eval("("+json+")");
if(!o) {
throw {message: "CFJsonReader.read: Json object not found"};
}
if(o.metaData){
delete this.ef;
this.meta = o.metaData;
this.recordType = Ext.data.Record.create(o.metaData.fields);
this.onMetaChange(this.meta, this.recordType, o);
}
return this.readRecords(o);
}
});You can see that line four does a regex replacement to the json string in order to strip out the meta tag. Is there a cleaner way to do this?
Thanks,
Mike
I have a similar issue. My json data is very complex, arrays embedded in arrays. I don't think you can use the JsonStores to get the 2nd and third level array elements. How do I get an event call for the read of the jsondata before it goes into the store. I can't override the JsonStore since I have 5 or six different ones.
Rinaldo
I see a similar questions was asked a year ago.
http://www.extjs.com/forum/showthread.php?t=37367&highlight=subclass
http://extjs.com/forum/showthread.php?t=8230&highlight=coldfusion
aconran is one of the community Coldfusion guys though.
#If you have any other info about this subject , Please add it free.# |