Creating components using Sencha Cmd
It is possible to use Sencha Cmd to generate skeleton components. The most useful of these commands are those used to generate basic models.
Generating model skeletons
A model skeleton can be generated very easily using the Sencha Cmd Tool. The syntax is as follows:
sencha generate model ModelName [field1:fieldType,field2:fieldType…]
This command must be executed in the application root (the directory in which the app.js
file is found). Note that there must not be any spaces in the comma-separated field listing. The company model skeleton can be generated by executing the following command:
sencha generate model Company idCompany:int,companyName:string
The final string
for the companyName
field is not strictly required as the default property type is string
, if not specified. The output from this command looks as shown in the following screenshot:
The generated Company.js
file is written into the app/model
directory and has the following content:
Ext.define...