Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare module ngTable {
- interface IDefaultParams {
- page?: number;
- count?: number;
- filter?: IFilterDef;
- sorting?: ISortingDef;
- group?: {};
- groupBy?: any;
- }
- interface IDefaultSettings {
- total: number;
- defaultSort?: string;
- filterDelay?: number;
- counts?: number[];
- getGroups? ($defer: ng.IDeferred<any>, column: any): any;
- getData($defer: ng.IDeferred<any>, params: IParams): any;
- }
- interface ISortingDef {
- [key: string]: string;
- }
- interface IFilterDef {
- [key: string]: string;
- }
- interface IParams
- {
- /**
- * Gets or sets the count of the result-set.
- *
- * @param count A number to set as the current resultset count. This is optional
- */
- count(count?: number): number;
- /**
- * Gets or sets the filter of the result-set.
- *
- * @param filter The filter definition as an object { fieldName:filterValue }. This is optional
- */
- filter(filter?: IFilterDef): any;
- generatePagesArray(currentPage, totalItems, pageSize): any;
- getData($defer: ng.IDeferred<any>, params: IParams): ng.IPromise<any>;
- getGroups($defer: ng.IDeferred<any>, column): ng.IPromise<any>;
- isSortBy(field: string, direction: string): boolean;
- /**
- * Return object of sorting parameters for angular filter.
- *
- * @returns Array like: [ '-name', '+age' ]
- */
- orderBy(): any[];
- /**
- * Gets or sets the current page postion.
- *
- * @param page The page number to go to. This is optional
- */
- page(page?: number): number;
- /**
- * Gets or sets the current parameters.
- *
- * @param newParameters The default params to alter. This is optional
- * @param parseParamsFromUrl Define if the current url parameters chould be taken into account. This is optional
- */
- parameters(newParameters?: IDefaultParams, parseParamsFromUrl?: boolean): IParams;
- reload(): Q.Promise<any>;
- reloadPages(): void;
- /**
- * Gets or sets the current settings.
- *
- * @param newSettings The settings to alter. This is optional
- * @returns current settings of the IParams object itself.
- */
- settings(newSettings?: IDefaultSettings): any;
- /**
- * Gets or sets the current sorting field and direction.
- *
- * @param sorting The new sorting definition. This is optional
- */
- sorting(sorting?: ISortingDef): ISortingDef;
- /**
- * Gets or sets the current sorting field and direction.
- *
- * @param sorting The new sorting field. This is optional
- * @param direction The new sorting direction. This is optional
- */
- sorting(sorting: any, direction?: string): ISortingDef;
- /**
- * Gets or sets the current total items count in the settings.
- *
- * @param total The new total number of reccords. This is optional
- * @returns current number of total results or the IParams object itself.
- */
- total(total?: number): any;
- /**
- * Gets params for url maybe.
- *
- * @param asString flag indicates return array of string or object
- * @returns If asString = true will be return array of url string parameters else key-value object.
- */
- url(asString: boolean): any;
- /* original options */
- $params: any;
- }
- interface IParamsFactory {
- new (params: IDefaultParams, settings?: IDefaultSettings): IParams;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement