I have some models that are dynamically created based on user activity, the record definition is pulled via Ajax.
So what's the *right* way to do this? Tracking creation separately via a boolean variable won't work, the page may have any number of dynamically-created models. (I could use a dictionary, but it seems silly if I can't just ask ExtJS if something has been defined.)
Each time the user performs the action, I need to see if the model has already been defined before bothering to define it again.
The documentation for the `Ext.isDefined` method seemed to suggest this would work, but it doesn't.
Code:
if(!Ext.isDefined(modelId)) {
Ext.define(modelId, { extend: "Ext.data.Model", fields: RecordDef });
}
So what's the *right* way to do this? Tracking creation separately via a boolean variable won't work, the page may have any number of dynamically-created models. (I could use a dictionary, but it seems silly if I can't just ask ExtJS if something has been defined.)
Aucun commentaire:
Enregistrer un commentaire