Last active
June 8, 2020 11:51
-
-
Save hbulens/ec88686ac2bcb607e87122180445b5fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare var Ext: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myGrid = Ext.create<MyApp.grids.Users>("SchedulerApp.view.UserGrid"); | |
const currentSelection = myGrid.getSelectionModel().getSelection(); | |
// currentSelection is a type of Ext.selection.Model | |
// myapp.view.users.ts | |
Ext.define<MyApp.grids.Users>("MyApp.view.Users", { | |
extend: "Ext.grid.Panel", | |
selModel: { | |
mode: "MULTI" | |
}, | |
columns: [ | |
Ext.create<any>("MyApp.columns.shared.Name", { filter: { type: "owner" } }) | |
] | |
} | |
// myapp.grids.d.ts | |
declare module MyApp.grids { | |
export class Users extends Ext.grid.Panel { | |
} | |
} | |
// ext.grid.d.ts | |
declare module Ext.grid { | |
export interface Panel extends Ext.Component { | |
getSelectionModel?(): Ext.selection.Model; | |
on?(eventName: string, callback: any): void; | |
setDisabled?(val: boolean): void; | |
getStore?(): Ext.data.Store; | |
} | |
} | |
declare module Ext { | |
export interface Component { | |
extend?: string, | |
selModel?: Ext.selection.Model, | |
columns?: any[] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module Ext { | |
export function create<T>(className: string, config?: T): T; | |
export function define<T>(className: string, config: T); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define("MyApp.view.CustomersGrid", { | |
extend: "Ext.grid.Panel", | |
selModel: { | |
selType: "rowmodel", | |
mode: "SINGLE" | |
}, | |
columns: [{ | |
text: 'Name', | |
flex: 1, | |
dataIndex: 'name' | |
}, { | |
text: 'Location', | |
dataIndex: 'location' | |
}], | |
initComponent: function () { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.define("MyApp.panel.Grid", { | |
constructor(config) { | |
this.callParent(arguments); | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module MyApp.panel { | |
export class Grid { | |
constructor(config: any) { | |
super(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment