Merge pull request #2263 from slozier/patch-1

Update SlickGrid.d.ts
This commit is contained in:
Masahiro Wakame
2014-06-12 16:14:07 +09:00

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>);
@@ -779,11 +779,18 @@ declare module Slick {
/**
* Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that.
* @param newData New databinding source. This can either be a regular JavaScript array or a custom object exposing getItem(index) and getLength() functions.
* @param newData New databinding source using a regular JavaScript array..
* @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid.
**/
public setData(newData: T[], scrollToTop: boolean): void;
/**
* Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that.
* @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: DataProvider<T>, scrollToTop: boolean): void;
/**
* Returns the size of the databinding source.
* @return
@@ -1478,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>);
@@ -1548,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>;