/// namespace MyApp.view { export interface CompanyGridPanel extends Ext.grid.IPanel { } } Ext.define("MyApp.view.CompanyGridPanel", { extend: "Ext.grid.Panel", alias: ["widget.myApp-view-companyGridPanel"], config: { companyStore: null }, initComponent: function () { Ext.applyIf(this, { itemId: "companyGridPanel", title: "Company Listing", store: this.companyStore, columnLines: true, columns: [ { xtype: "gridcolumn", dataIndex: "company", text: "Company", flex: 1 }, { xtype: "numbercolumn", dataIndex: "price", text: "Price", renderer: Ext.util.Format.usMoney }, { xtype: "numbercolumn", dataIndex: "change", text: "Change", format: "0.00" }, { xtype: "numbercolumn", dataIndex: "pctChange", text: "% Change", format: "0.00" }, { xtype: "datecolumn", dataIndex: "lastChange", text: "Last Change" }, { xtype: "gridcolumn", dataIndex: "industry", text: "Industry" } ], tbar: [ { xtype: "checkbox", itemId: "manufacturingFilter", boxLabel: "Show only Manufacturing companies" } ] }); return this.callParent(arguments); } }); function test_create() { var gridPanel: MyApp.view.CompanyGridPanel = Ext.create("MyApp.view.CompanyGridPanel"); var isVisible: boolean = gridPanel.isVisible(); gridPanel.setWidth(500); var items: Ext.IComponent[] = gridPanel.items; var columns: Ext.grid.IColumn[] = gridPanel.columns; var isArray: boolean = Ext.isArray(columns); } function test_events() { var gridPanel: MyApp.view.CompanyGridPanel = Ext.create("MyApp.view.CompanyGridPanel"); gridPanel.on("select", testEventHandler, this); gridPanel.fireEvent("select", null, this); } function testEventHandler( grid, record, index, eventOptions) { return true; } // TODO: Add more tests, but the Grid class is one of the most complex components in Ext JS, so using it tests a huge swathe of the underlying definition because it and its parents extend/implement a large number of types.