I would like to assign an enum field in model.
Something like this:
fields:[
{name:'method', type:'string', enum:['method1', 'method2', 'method3']}
]
And I want other components are able to know how many members in the enum, or even can access the enum members by a number.(just like using Array)
Does ExtJS4.1 have any feature like that? I cannot find anything like that in the api.
The short answer is that it is not straightforward.
If you look at these docs, you’ll see that there’s no enum option.
However, as the same docs suggest, you can create your own data types. So you can simulate an enum there. I suggest you look at the implementation of existing types (date, for example) to see how this is done.