diff --git a/ng-grid/ng-grid-tests.ts b/ng-grid/ng-grid-tests.ts index 5f4ab6ce5..53763b1a5 100644 --- a/ng-grid/ng-grid-tests.ts +++ b/ng-grid/ng-grid-tests.ts @@ -1,27 +1,27 @@ /// -var options1: ngGrid.GridOptions = { +var options1: ngGrid.IGridOptions = { data: [{ 'Name': 'Bob' }, { 'Name': 'Jane' }] }; -var options2: ngGrid.GridOptions = { +var options2: ngGrid.IGridOptions = { afterSelectionChange: () => { }, - beforeSelectionChange: () => { }, + beforeSelectionChange: () => {return true; }, dataUpdated: () => { } }; -var options3: ngGrid.GridOptions = { +var options3: ngGrid.IGridOptions = { columnDefs: [ { field: 'name', displayName: 'Name' }, { field: 'age', displayName: 'Age' } ] }; -var options4: ngGrid.GridOptions = { +var options4: ngGrid.IGridOptions = { pagingOptions: { pageSizes: [1, 2, 3, 4], pageSize: 2, totalServerItems: 100, currentPage: 1 } -}; \ No newline at end of file +}; diff --git a/ng-grid/ng-grid.d.ts b/ng-grid/ng-grid.d.ts index 48eec367a..f081b362c 100644 --- a/ng-grid/ng-grid.d.ts +++ b/ng-grid/ng-grid.d.ts @@ -11,13 +11,13 @@ declare class ngGridReorderable { declare module ngGrid { - export interface GridOptions { + export interface IGridOptions { /** Define an aggregate template to customize the rows when grouped. See github wiki for more details. */ - aggregateTemplate?: any; + aggregateTemplate?: string; /** Callback for when you want to validate something after selection. */ - afterSelectionChange?: Function; + afterSelectionChange?: (rowItem?: any, event?: any) => void ; /** Callback if you want to inspect something before selection, return false if you want to cancel the selection. return true otherwise. @@ -25,16 +25,16 @@ declare module ngGrid { use rowItem.changeSelection(event) method after returning false initially. Note: when shift+ Selecting multiple items in the grid this will only get called once and the rowItem will be an array of items that are queued to be selected. */ - beforeSelectionChange?: Function; + beforeSelectionChange?: (rowItem?: any, event?: any) => boolean ; /** checkbox templates. */ - checkboxCellTemplate?: any; + checkboxCellTemplate?: string; /** checkbox templates. */ - checkboxHeaderTemplate?: any; + checkboxHeaderTemplate?: string; /** definitions of columns as an array [], if not defined columns are auto-generated. See github wiki for more details. */ - columnDefs?: ColumnDef[]; + columnDefs?: IColumnDef[]; /** Data being displayed in the grid. Each item in the array is mapped to a row being displayed. */ data?: any[]; @@ -79,7 +79,7 @@ declare module ngGrid { filterText: The text bound to the built-in search box. useExternalFilter: Bypass internal filtering if you want to roll your own filtering mechanism but want to use builtin search box. */ - filterOptions?: FilterOptions; + filterOptions?: IFilterOptions; /** Defining the height of the footer in pixels. */ footerRowHeight?: number; @@ -91,7 +91,7 @@ declare module ngGrid { headerRowHeight?: number; /** Define a header row template for further customization. See github wiki for more details. */ - headerRowTemplate?: any; + headerRowTemplate?: string; /** Enables the use of jquery UI reaggable/droppable plugin. requires jqueryUI to work if enabled. Useful if you want drag + drop but your users insist on crappy browsers. */ @@ -105,13 +105,13 @@ declare module ngGrid { /** Maintains the column widths while resizing. Defaults to true when using *'s or undefined widths. Can be ovverriden by setting to false. */ - maintainColumnRatios?: any; + maintainColumnRatios?: boolean; /** Set this to false if you only want one item selected at a time */ multiSelect?: boolean; /** pagingOptions - */ - pagingOptions?: PagingOptions; + pagingOptions?: IPagingOptions; /** Array of plugin functions to register in ng-grid */ pinSelectionCheckbox?: boolean; @@ -123,7 +123,7 @@ declare module ngGrid { rowHeight?: number; /** Define a row template to customize output. See github wiki for more details. */ - rowTemplate?: any; + rowTemplate?: string; /** all of the items selected in the grid. In single select mode there will only be one item in the array. */ selectedItems?: any[]; @@ -170,15 +170,20 @@ declare module ngGrid { enableHighlighting?: boolean; } - export interface ColumnDef { + export interface IColumnDef { + field?: string; + width?: any; //**this can be a string containing a relatively, absolute size units or a number: '30%','54px',45 /* + displayName?: string; + cellTemplate?: string; + enableCellEdit?: boolean; } - export interface FilterOptions { + export interface IFilterOptions { filterText?: string; useExternalFilter?: boolean; } - export interface PagingOptions { + export interface IPagingOptions { /** pageSizes: list of available page sizes. */ pageSizes?: number[]; /** pageSize: currently selected page size. */