If you want to define a class in Ext JS, then you have to use Ext.define().
Syntax
- Ext.define(class name, class member/ properties, callback function);
Here, we have discussed all the values of the syntax.
Class Name: It is the class name that is given by the user depending upon the application structure.
Class Member/Properties: Class member/properties are used to determine the class behavior.
Callback Function: It is a function that is invoked when the class is loaded. It is an optional function to use.
Example
- Ext.define (employeeApp.view.EmployeeDetailsGrid,
- {
- extend : 'Ext.grid.GridPanel',
- id : 'employeesDetailsGrid',
- store : 'EmployeesDetailsGridStore',
- renderTo : 'employeesDetailsRenderDiv',
- layout : 'fit',
- columns : [{
- text : 'Employee Name',
- dataIndex : 'employeeName'
- }, {
- text : 'ID',
- dataIndex : 'employeeId'
- }, {
- text : 'Department',
- dataIndex : 'department'
- }]
- });