View Full Version : Passing functions to JsonReader's metaData object

15 Jun 2010, 1:12 PM
I have a JsonStore that gets its metaData from an AJAX request, and passes it to its JsonReader, as described here (http://www.sencha.com/deploy/dev/docs/?class=Ext.data.JsonReader) under "Automatic configuration using metaData".

I return the Ext.data.Field properties in the AJAX response like this:

metaData: {
"fields": [
{"name": "name"},
{"name": "job", "mapping": "occupation"}

However, this will only work for string/number/boolean properties like "name" and "mapping". It won't work for properties like "convert" or "sortType", which require a function object.

I was thinking of returning a function name instead, and substituting the actual function object before JsonReader gets to it. But there doesn't seem to be anywhere in JsonReader that I can intercept the JSON response and change it, before it reads the metaData.

Has anyone solved this problem another way?