Fix build errors and add a test

This commit is contained in:
huer12
2014-01-15 20:57:14 +01:00
parent 2269608620
commit 5b515967e7
2 changed files with 39 additions and 4 deletions
+34
View File
@@ -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;
}
}
}
+5 -4
View File
@@ -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.