Update SlickGrid.d.ts

Updated DataProvider to DataProvider<T extends SlickData>
This commit is contained in:
slozier
2014-05-29 10:31:34 -04:00
parent e7c3b12277
commit 2a3bb99eb7
+8 -8
View File
@@ -689,8 +689,8 @@ declare module Slick {
topPanelHeight?: number;
}
export interface DataProvider {
getItem(index: number): SlickData;
export interface DataProvider<T extends SlickData> {
getItem(index: number): T;
getLength(): number;
}
@@ -705,7 +705,7 @@ declare module Slick {
* The grid also provides two helper methods to simplify development - getSelectedRows() and setSelectedRows(rowsArray), as well as an onSelectedRowsChanged event.
* SlickGrid includes two pre-made selection models - Slick.CellSelectionModel and Slick.RowSelectionModel, but you can easily write a custom one.
**/
export class SelectionModel<T extends Slick.SlickData, E> {
export class SelectionModel<T extends SlickData, E> {
/**
* An initializer function that will be called with an instance of the grid whenever a selection model is registered with setSelectionModel. The selection model can use this to initialize its state and subscribe to grid events.
**/
@@ -740,12 +740,12 @@ declare module Slick {
options: GridOptions<T>);
constructor(
container: string,
data: DataProvider,
data: DataProvider<T>,
columns: Column<T>[],
options: GridOptions<T>);
constructor(
container: HTMLElement,
data: DataProvider,
data: DataProvider<T>,
columns: Column<T>[],
options: GridOptions<T>);
@@ -789,7 +789,7 @@ declare module Slick {
* @param newData New databinding source using a custom object exposing getItem(index) and getLength() functions.
* @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid.
**/
public setData(newData: { getItem: (index: number) => T; getLength: () => number; }, scrollToTop: boolean): void;
public setData(newData: DataProvider<T>, scrollToTop: boolean): void;
/**
* Returns the size of the databinding source.
@@ -1485,7 +1485,7 @@ declare module Slick {
* Item -> Data by index
* Row -> Data by row
**/
export class DataView<T extends Slick.SlickData> implements DataProvider {
export class DataView<T extends Slick.SlickData> implements DataProvider<T> {
constructor(options?: DataViewOptions<T>);
@@ -1555,7 +1555,7 @@ declare module Slick {
public syncGridCellCssStyles(grid: Grid<T>, key: string): void;
public getLength(): number;
public getItem(index: number): SlickData;
public getItem(index: number): T;
public getItemMetadata(): void;
public onRowCountChanged: Slick.Event<OnRowCountChangedEventData>;