thebashi
6 Jul 2007, 12:49 AM
hi everybody,
i have a strange situation. in my application, i have couple type of datastore objects. and everyone has its unique record definition.
var sampleRecDef=new Array();
sampleRecDef[0]='id';
sampleRecDef[1]='name';
sampleRecDef[2]='lastname';
recordDefinitions.add('key',sampleRecDef);//i keep this definition for further use
Ext.data.Record.create(sampleRecDef);
then i use these record object in datastores.
in some point of application, i need an object which has these attributes as its member variables. something like this
var tmp={id:'x',name:'x',lastname:'x'}
and these 'x' values will be set from datastore's records.
i have found kind of a solution, which is creating a string of JSON which is similar to above code. then "eval" ing it. Eval part can be replaced with ext's json utility.
however i dont believe this is best solution.
Is there a better way to do this thing (i dont know how to name it :)
i have a strange situation. in my application, i have couple type of datastore objects. and everyone has its unique record definition.
var sampleRecDef=new Array();
sampleRecDef[0]='id';
sampleRecDef[1]='name';
sampleRecDef[2]='lastname';
recordDefinitions.add('key',sampleRecDef);//i keep this definition for further use
Ext.data.Record.create(sampleRecDef);
then i use these record object in datastores.
in some point of application, i need an object which has these attributes as its member variables. something like this
var tmp={id:'x',name:'x',lastname:'x'}
and these 'x' values will be set from datastore's records.
i have found kind of a solution, which is creating a string of JSON which is similar to above code. then "eval" ing it. Eval part can be replaced with ext's json utility.
however i dont believe this is best solution.
Is there a better way to do this thing (i dont know how to name it :)