mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Fix build errors and add a test
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
/// <reference path="ko-grid.d.ts" />
|
||||
|
||||
module KoGridTests
|
||||
{
|
||||
export interface IGridItem {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export class Tests {
|
||||
public items: KnockoutObservableArray<IGridItem>;
|
||||
public selectedItems: KnockoutObservableArray<IGridItem>;
|
||||
public gridOptionsAlarms: kg.GridOptions<IGridItem>;
|
||||
|
||||
constructor() {
|
||||
this.items = ko.observableArray<IGridItem>();
|
||||
this.selectedItems = ko.observableArray<IGridItem>();
|
||||
this.gridOptionsAlarms = this.createDefaultGridOptions(this.items, this.selectedItems);
|
||||
}
|
||||
|
||||
public createDefaultGridOptions<Type>(dataArray: KnockoutObservableArray<Type>, selectedItems: KnockoutObservableArray<Type>): kg.GridOptions<Type> {
|
||||
var result = {
|
||||
data: dataArray,
|
||||
displaySelectionCheckbox: false,
|
||||
footerVisible: false,
|
||||
multiSelect: false,
|
||||
showColumnMenu: false,
|
||||
plugins: null,
|
||||
selectedItems: selectedItems
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+5
-4
@@ -4,11 +4,12 @@
|
||||
|
||||
// These are very definitely preliminary. Please feel free to improve.
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
declare module kg {
|
||||
export interface DomUtilityService {
|
||||
UpdateGridLayout(grid: Grid<any>);
|
||||
BuildStyles(grid: Grid<any>);
|
||||
UpdateGridLayout(grid: Grid<any>): void;
|
||||
BuildStyles(grid: Grid<any>): void;
|
||||
}
|
||||
|
||||
var domUtilityService: DomUtilityService;
|
||||
@@ -23,7 +24,7 @@ declare module kg {
|
||||
}
|
||||
|
||||
export interface SelectionService<EntityType> {
|
||||
setSelection(row: Row<EntityType>, selected: boolean);
|
||||
setSelection(row: Row<EntityType>, selected: boolean): void;
|
||||
multi: boolean;
|
||||
lastClickedRow: Row<EntityType>;
|
||||
}
|
||||
@@ -42,7 +43,7 @@ declare module kg {
|
||||
|
||||
export interface GridOptions<EntityType> {
|
||||
/** Callback for when you want to validate something after selection. */
|
||||
afterSelectionChange?(row: Row<EntityType>);
|
||||
afterSelectionChange?(row: Row<EntityType>): void;
|
||||
|
||||
/** Callback if you want to inspect something before selection,
|
||||
return false if you want to cancel the selection. return true otherwise.
|
||||
|
||||
Reference in New Issue
Block a user