forked from jbaroudi/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SlickGrid.d.ts
1758 lines (1443 loc) · 51.9 KB
/
SlickGrid.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for SlickGrid 2.1.0
// Project: https://github.com/mleibman/SlickGrid
// Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
SlickGrid-2.1.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/SlickGrid.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
/// <reference path="../jquery/jquery.d.ts" />
interface DOMEvent extends Event {}
declare module Slick {
/**
* slick.core.js
**/
/**
* An event object for passing data to event handlers and letting them control propagation.
* <p>This is pretty much identical to how W3C and jQuery implement events.</p>
* @class EventData
* @constructor
**/
export class EventData {
constructor();
/***
* Stops event from propagating up the DOM tree.
* @method stopPropagation
*/
public stopPropagation(): void;
/***
* Returns whether stopPropagation was called on this event object.
* @method isPropagationStopped
* @return {Boolean}
*/
public isPropagationStopped(): boolean;
/***
* Prevents the rest of the handlers from being executed.
* @method stopImmediatePropagation
*/
public stopImmediatePropagation(): void;
/***
* Returns whether stopImmediatePropagation was called on this event object.\
* @method isImmediatePropagationStopped
* @return {Boolean}
*/
public isImmediatePropagationStopped(): boolean;
}
/***
* A simple publisher-subscriber implementation.
* @class Event
* @constructor
*/
export class Event<T> {
constructor();
/***
* Adds an event handler to be called when the event is fired.
* <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code>
* object the event was fired with.<p>
* @method subscribe
* @param fn {Function} Event handler.
*/
public subscribe(fn: (eventData: EventData, data: T) => any ): void;
/***
* Removes an event handler added with <code>subscribe(fn)</code>.
* @method unsubscribe
* @param fn {Function} Event handler to be removed.
*/
public unsubscribe(fn: (eventData: EventData, data: T) => any ): void;
/***
* Fires an event notifying all subscribers.
* @method notify
* @param args {Object} Additional data object to be passed to all handlers.
* @param e {EventData}
* Optional.
* An <code>EventData</code> object to be passed to all handlers.
* For DOM events, an existing W3C/jQuery event object can be passed in.
* @param scope {Object}
* Optional.
* The scope ("this") within which the handler will be executed.
* If not specified, the scope will be set to the <code>Event</code> instance.
* @return Last run callback result.
* @note slick.core.Event.notify shows this method as returning a value, type is unknown.
*/
public notify(args?: T, e?: EventData, scope?: any): any;
public notify(args?: T, e?: DOMEvent, scope?: any): any;
}
// todo: is this private? there are no comments in the code
export class EventHandler {
constructor();
public subscribe(event: EventData, handler: Function): EventHandler;
public unsubscribe(event: EventData, handler: Function): EventHandler;
public unsubscribeAll(): EventHandler;
}
/***
* A structure containing a range of cells.
* @class Range
**/
export class Range {
/**
* A structure containing a range of cells.
* @constructor
* @param fromRow {Integer} Starting row.
* @param fromCell {Integer} Starting cell.
* @param toRow {Integer} Optional. Ending row. Defaults to <code>fromRow</code>.
* @param toCell {Integer} Optional. Ending cell. Defaults to <code>fromCell</code>.
**/
constructor(fromRow: number, fromCell: number, toRow?: number, toCell?: number);
/***
* @property fromRow
* @type {Integer}
*/
public fromRow: number;
/***
* @property fromCell
* @type {Integer}
*/
public fromCell: number;
/***
* @property toRow
* @type {Integer}
*/
public toRow: number;
/***
* @property toCell
* @type {Integer}
*/
public toCell: number;
/***
* Returns whether a range represents a single row.
* @method isSingleRow
* @return {Boolean}
*/
public isSingleRow(): boolean;
/***
* Returns whether a range represents a single cell.
* @method isSingleCell
* @return {Boolean}
*/
public isSingleCell(): boolean;
/***
* Returns whether a range contains a given cell.
* @method contains
* @param row {Integer}
* @param cell {Integer}
* @return {Boolean}
*/
public contains(row: number, cell: number): boolean;
/***
* Returns a readable representation of a range.
* @method toString
* @return {String}
*/
public toString(): string;
}
/***
* A base class that all special / non-data rows (like Group and GroupTotals) derive from.
* @class NonDataItem
* @constructor
*/
export class NonDataRow {
}
/***
* Information about a group of rows.
* @class Group
* @extends Slick.NonDataItem
* @constructor
*/
export class Group<T extends SlickData> extends NonDataRow {
constructor();
/**
* Grouping level, starting with 0.
* @property level
* @type {Number}
*/
public level: number;
/***
* Number of rows in the group.
* @property count
* @type {Integer}
*/
public count: number;
/***
* Grouping value.
* @property value
* @type {Object}
*/
public value: any;
/***
* Formatted display value of the group.
* @property title
* @type {String}
*/
public title: string;
/***
* Whether a group is collapsed.
* @property collapsed
* @type {Boolean}
*/
public collapsed: boolean;
/***
* GroupTotals, if any.
* @property totals
* @type {GroupTotals}
*/
public totals: GroupTotals<T>;
/**
* Rows that are part of the group.
* @property rows
* @type {Array}
*/
public rows: T[];
/**
* Sub-groups that are part of the group.
* @property groups
* @type {Array}
*/
public groups: Group<T>[];
/**
* A unique key used to identify the group. This key can be used in calls to DataView
* collapseGroup() or expandGroup().
* @property groupingKey
* @type {Object}
*/
public groupingKey: any;
/***
* Compares two Group instances.
* @method equals
* @return {Boolean}
* @param group {Group} Group instance to compare to.
* todo: this is on the prototype (NonDataRow()) instance, not Group, maybe doesn't matter?
*/
public equals(group: Group<T>): boolean;
}
/***
* Information about group totals.
* An instance of GroupTotals will be created for each totals row and passed to the aggregators
* so that they can store arbitrary data in it. That data can later be accessed by group totals
* formatters during the display.
* @class GroupTotals
* @extends Slick.NonDataItem
* @constructor
*/
export class GroupTotals<T> extends NonDataRow {
constructor();
/***
* Parent Group.
* @param group
* @type {Group}
*/
public group: Group<T>;
}
/***
* A locking helper to track the active edit controller and ensure that only a single controller
* can be active at a time. This prevents a whole class of state and validation synchronization
* issues. An edit controller (such as SlickGrid) can query if an active edit is in progress
* and attempt a commit or cancel before proceeding.
* @class EditorLock
* @constructor
*/
export class EditorLock<T extends Slick.SlickData> {
constructor();
/***
* Returns true if a specified edit controller is active (has the edit lock).
* If the parameter is not specified, returns true if any edit controller is active.
* @method isActive
* @param editController {EditController}
* @return {Boolean}
*/
public isActive(editController: Editors.Editor<T>): boolean;
/***
* Sets the specified edit controller as the active edit controller (acquire edit lock).
* If another edit controller is already active, and exception will be thrown.
* @method activate
* @param editController {EditController} edit controller acquiring the lock
*/
public activate(editController: Editors.Editor<T>): void;
/***
* Unsets the specified edit controller as the active edit controller (release edit lock).
* If the specified edit controller is not the active one, an exception will be thrown.
* @method deactivate
* @param editController {EditController} edit controller releasing the lock
*/
public deactivate(editController: Editors.Editor<T>): void;
/***
* Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit
* controller and returns whether the commit attempt was successful (commit may fail due to validation
* errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded
* and false otherwise. If no edit controller is active, returns true.
* @method commitCurrentEdit
* @return {Boolean}
*/
public commitCurrentEdit(): boolean;
/***
* Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit
* controller and returns whether the edit was successfully cancelled. If no edit controller is
* active, returns true.
* @method cancelCurrentEdit
* @return {Boolean}
*/
public cancelCurrentEdit(): boolean;
}
/**
* A global singleton editor lock.
* @class GlobalEditorLock
* @static
* @constructor
**/
export var GlobalEditorLock: EditorLock<Slick.SlickData>;
/**
* slick.grid.js
**/
/**
* Options which you can apply to the columns objects.
**/
export interface Column<T extends Slick.SlickData> {
/**
* This accepts a function of the form function(cellNode, row, dataContext, colDef) and is used to post-process the cell's DOM node / nodes
* @param cellNode
* @param row
* @param dataContext
* @param colDef
* @return
**/
asyncPostRender?: (cellNode:any, row:any, dataContext:any, colDef:any) => void;
/**
* Used by the the slick.rowMoveManager.js plugin for moving rows. Has no effect without the plugin installed.
**/
behavior?: any;
/**
* In the "Add New" row, determines whether clicking cells in this column can trigger row addition. If true, clicking on the cell in this column in the "Add New" row will not trigger row addition.
**/
cannotTriggerInsert?: boolean;
/**
* Accepts a string as a class name, applies that class to every row cell in the column.
**/
cssClass?: string;
/**
* When set to true, the first user click on the header will do a descending sort. When set to false, the first user click on the header will do an ascending sort.
**/
defaultSortAsc?: boolean;
/**
* The editor for cell edits {TextEditor, IntegerEditor, DateEditor...} See slick.editors.js
**/
editor?: any; // typeof Editors.Editor<T>;
/**
* The property name in the data object to pull content from. (This is assumed to be on the root of the data object.)
**/
field?: string;
/**
* When set to false, clicking on a cell in this column will not select the row for that cell. The cells in this column will also be skipped during tab navigation.
**/
focusable?: boolean;
/**
* This accepts a function of the form function(row, cell, value, columnDef, dataContext) and returns a formatted version of the data in each cell of this column. For example, setting formatter to function(r, c, v, cd, dc) { return "Hello!"; } would overwrite every value in the column with "Hello!" See defaultFormatter in slick.grid.js for an example formatter.
* @param row
* @param cell
* @param value
* @param columnDef
* @param dataContext
* @return
**/
formatter?: Formatter<T>;
/**
* Accepts a string as a class name, applies that class to the cell for the column header.
**/
headerCssClass?: string;
/**
* A unique identifier for the column within the grid.
**/
id?: string;
/**
* Set the maximum allowable width of this column, in pixels.
**/
maxWidth?: number;
/**
* Set the minimum allowable width of this column, in pixels.
**/
minWidth?: number;
/**
* The text to display on the column heading.
**/
name?: string;
/**
* If set to true, whenever this column is resized, the entire table view will rerender.
**/
rerenderOnResize?: boolean;
/**
* If false, column can no longer be resized.
**/
resizable?: boolean;
/**
* If false, when a row is selected, the CSS class for selected cells ("selected" by default) is not applied to the cell in this column.
**/
selectable?: boolean;
/**
* If true, the column will be sortable by clicking on the header.
**/
sortable?: boolean;
/**
* If set to a non-empty string, a tooltip will appear on hover containing the string.
**/
toolTip?: string;
/**
* Width of the column in pixels. (May often be overridden by things like minWidth, maxWidth, forceFitColumns, etc.)
**/
width?: number;
}
export interface EditorFactory {
getEditor<T>(column: Column<T>): Editors.Editor<T>;
}
export interface FormatterFactory<T extends SlickData> {
getFormatter(column: Column<T>): Formatter<any>;
}
export interface GridOptions<T extends SlickData> {
/**
* Makes cell editors load asynchronously after a small delay. This greatly increases keyboard navigation speed.
**/
asyncEditorLoading?: boolean;
/**
* Delay after which cell editor is loaded. Ignored unless asyncEditorLoading is true.
**/
asyncEditorLoadDelay?: number;
/**
*
**/
asyncPostRenderDelay?: number;
/**
* Cell will not automatically go into edit mode when selected.
**/
autoEdit?: boolean;
/**
*
**/
autoHeight?: boolean;
/**
* A CSS class to apply to flashing cells via flashCell().
**/
cellFlashingCssClass?: string;
/**
* A CSS class to apply to cells highlighted via setHighlightedCells().
**/
cellHighlightCssClass?: string;
/**
*
**/
dataItemColumnValueExtractor?: any;
/**
*
**/
defaultColumnWidth?: number;
/**
*
**/
defaultFormatter?: Formatter<T>;
/**
*
**/
editable?: boolean;
/**
* Not listed as a default under options in slick.grid.js
**/
editCommandHandler?: any; // queueAndExecuteCommand
/**
* A factory object responsible to creating an editor for a given cell. Must implement getEditor(column).
**/
editorFactory?: EditorFactory;
/**
* A Slick.EditorLock instance to use for controlling concurrent data edits.
**/
editorLock?: EditorLock<T>;
/**
* If true, a blank row will be displayed at the bottom - typing values in that row will add a new one. Must subscribe to onAddNewRow to save values.
**/
enableAddRow?: boolean;
/**
* If true, async post rendering will occur and asyncPostRender delegates on columns will be called.
**/
enableAsyncPostRender?: boolean;
/**
* *WARNING*: Not contained in SlickGrid 2.1, may be deprecated
**/
enableCellRangeSelection?: any;
/**
* Appears to enable cell virtualisation for optimised speed with large datasets
**/
enableCellNavigation?: boolean;
/**
*
**/
enableColumnReorder?: boolean;
/**
* *WARNING*: Not contained in SlickGrid 2.1, may be deprecated
**/
enableRowReordering?: any;
/**
*
**/
enableTextSelectionOnCells?: boolean;
/**
* @see Example: Explicit Initialization
**/
explicitInitialization?: boolean;
/**
* Force column sizes to fit into the container (preventing horizontal scrolling). Effectively sets column width to be 1/Number of Columns which on small containers may not be desirable
**/
forceFitColumns?: boolean;
/**
*
**/
forceSyncScrolling?: boolean;
/**
* A factory object responsible to creating a formatter for a given cell. Must implement getFormatter(column).
**/
formatterFactory?: FormatterFactory<T>;
/**
* Will expand the table row divs to the full width of the container, table cell divs will remain aligned to the left
**/
fullWidthRows?: boolean;
/**
*
**/
headerRowHeight?: number;
/**
*
**/
leaveSpaceForNewRows?: boolean;
/**
* @see Example: Multi-Column Sort
**/
multiColumnSort?: boolean;
/**
*
**/
multiSelect?: boolean;
/**
*
**/
rowHeight?: number;
/**
*
**/
selectedCellCssClass?: string;
/**
*
**/
showHeaderRow?: boolean;
/**
* If true, the column being resized will change its width as the mouse is dragging the resize handle. If false, the column will resize after mouse drag ends.
**/
syncColumnCellResize?: boolean;
/**
*
**/
topPanelHeight?: number;
}
export interface DataProvider<T extends SlickData> {
/**
* Returns the number of data items in the set.
*/
getLength(): number;
/**
* Returns the item at a given index.
* @param index
*/
getItem(index: number): T;
/**
* Returns the metadata for the item at a given index (optional).
* @param index
*/
getItemMetadata?(index: number): RowMetadata<T>;
}
export interface SlickData {
// todo ? might be able to leave as empty
}
export interface RowMetadata<T> {
/**
* One or more (space-separated) CSS classes to be added to the entire row.
*/
cssClasses?: string;
/**
* Whether or not any cells in the row can be set as "active".
*/
focusable?: boolean;
/**
* Whether or not a row or any cells in it can be selected.
*/
selectable?: boolean;
/**
* Metadata related to individual columns
*/
columns?: {
/**
* Metadata indexed by column id
*/
[index: string]: ColumnMetadata<T>;
/**
* Metadata indexed by column index
*/
[index: number]: ColumnMetadata<T>;
}
}
export interface ColumnMetadata<T extends SlickData> {
/**
* Whether or not a cell can be set as "active".
*/
focusable?: boolean;
/**
* Whether or not a cell can be selected.
*/
selectable?: boolean;
/**
* A custom cell formatter.
*/
formatter?: Formatter<T>;
/**
* A custom cell editor.
*/
editor?: Slick.Editors.Editor<T>;
/**
* Number of columns this cell will span. Can also contain "*" to indicate that the cell should span the rest of the row.
*/
colspan?: number|string;
}
/**
* Selecting cells in SlickGrid is handled by a selection model.
* Selection models are controllers responsible for handling user interactions and notifying subscribers of the changes in the selection. Selection is represented as an array of Slick.Range objects.
* You can get the current selection model from the grid by calling getSelectionModel() and set a different one using setSelectionModel(selectionModel). By default, no selection model is set.
* 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 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.
**/
init(grid: Grid<T>): void;
/**
* A destructor function that will be called whenever a selection model is unregistered from the grid by a call to setSelectionModel with another selection model or whenever a grid with this selection model is destroyed. The selection model can use this destructor to unsubscribe from grid events and release all resources (remove DOM nodes, event listeners, etc.).
**/
destroy(): void;
onSelectedRangesChanged: Slick.Event<E>;
}
export class Grid<T extends SlickData> {
/**
* Create an instance of the grid.
* @param container Container node to create the grid in. This can be a DOM Element, a jQuery node, or a jQuery selector.
* @param data Databinding source. This can either be a regular JavaScript array or a custom object exposing getItem(index) and getLength() functions.
* @param columns An array of column definition objects. See Column Options for a list of options that can be included on each column definition object.
* @param options Additional options. See Grid Options for a list of options that can be included.
**/
constructor(
container: string|HTMLElement|JQuery,
data: T[]|DataProvider<T>,
columns: Column<T>[],
options: GridOptions<T>);
// #region Core
/**
* Initializes the grid. Called after plugins are registered. Normally, this is called by the constructor, so you don't need to call it. However, in certain cases you may need to delay the initialization until some other process has finished. In that case, set the explicitInitialization option to true and call the grid.init() manually.
**/
public init(): void;
/**
* todo: no docs
**/
public destroy(): void;
/**
* Returns an array of every data object, unless you're using DataView in which case it returns a DataView object.
* @return
**/
public getData(): any;
//public getData(): T[];
// Issue: typescript limitation, cannot differentiate calls by return type only, so need to cast to DataView or T[].
//public getData(): DataView;
/**
* Returns the databinding item at a given position.
* @param index Item index.
* @return
**/
public getDataItem(index: number): T;
/**
* 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 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
**/
public getDataLength(): number;
/**
* Returns an object containing all of the Grid options set on the grid. See a list of Grid Options here.
* @return
**/
public getOptions(): GridOptions<any>;
/**
* Returns an array of row indices corresponding to the currently selected rows.
* @return
**/
public getSelectedRows(): number[];
/**
* Returns the current SelectionModel. See here for more information about SelectionModels.
* @return
**/
public getSelectionModel(): SelectionModel<any, any>;
/**
* Extends grid options with a given hash. If an there is an active edit, the grid will attempt to commit the changes and only continue if the attempt succeeds.
* @options An object with configuration options.
**/
public setOptions(options: GridOptions<T>): void;
/**
* Accepts an array of row indices and applies the current selectedCellCssClass to the cells in the row, respecting whether cells have been flagged as selectable.
* @param rowsArray An array of row numbers.
**/
public setSelectedRows(rowsArray: number[]): void;
/**
* Unregisters a current selection model and registers a new one. See the definition of SelectionModel for more information.
* @selectionModel A SelectionModel.
**/
public setSelectionModel(selectionModel: SelectionModel<T, any>): void; // todo: don't know the type of the event data type
// #endregion Core
// #region Columns
/**
* Proportionately resizes all columns to fill available horizontal space. This does not take the cell contents into consideration.
**/
public autosizeColumns(): void;
/**
* Returns the index of a column with a given id. Since columns can be reordered by the user, this can be used to get the column definition independent of the order:
* @param id A column id.
* @return
**/
public getColumnIndex(id: string): number;
/**
* Returns an array of column definitions, containing the option settings for each individual column.
* @return
**/
public getColumns(): Column<T>[];
/**
* Sets grid columns. Column headers will be recreated and all rendered rows will be removed. To rerender the grid (if necessary), call render().
* @param columnDefinitions An array of column definitions.
**/
public setColumns(columnDefinitions: Column<T>[]): void;
/**
* Accepts a columnId string and an ascending boolean. Applies a sort glyph in either ascending or descending form to the header of the column. Note that this does not actually sort the column. It only adds the sort glyph to the header.
* @param columnId
* @param ascending
**/
public setSortColumn(columnId: string, ascending: boolean): void;
/**
* Accepts an array of objects in the form [ { columnId: [string], sortAsc: [boolean] }, ... ]. When called, this will apply a sort glyph in either ascending or descending form to the header of each column specified in the array. Note that this does not actually sort the column. It only adds the sort glyph to the header
* @param cols
**/
public setSortColumns(cols: { columnId: string; sortAsc: boolean }[]): void;
/**
* todo: no docs or comments available
* @return
**/
public getSortColumns(): { columnId: string; sortAsc: boolean }[];
/**
* Updates an existing column definition and a corresponding header DOM element with the new title and tooltip.
* @param columnId Column id.
* @param title New column name.
* @param toolTip New column tooltip.
**/
public updateColumnHeader(columnId: string, title?: string, toolTip?: string): void;
// #endregion Columns
// #region Cells
/**
* Adds an "overlay" of CSS classes to cell DOM elements. SlickGrid can have many such overlays associated with different keys and they are frequently used by plugins. For example, SlickGrid uses this method internally to decorate selected cells with selectedCellCssClass (see options).
* @param key A unique key you can use in calls to setCellCssStyles and removeCellCssStyles. If a hash with that key has already been set, an exception will be thrown.
* @param hash A hash of additional cell CSS classes keyed by row number and then by column id. Multiple CSS classes can be specified and separated by space.
* @example
* {
* 0: {
* "number_column": "cell-bold",
* "title_column": "cell-title cell-highlighted"
* },
* 4: {
* "percent_column": "cell-highlighted"
* }
* }
**/
public addCellCssStyles(key: string, hash: CellCssStylesHash): void;
/**
* Returns true if you can click on a given cell and make it the active focus.
* @param row A row index.
* @param col A column index.
* @return
**/
public canCellBeActive(row: number, col: number): boolean;
/**
* Returns true if selecting the row causes this particular cell to have the selectedCellCssClass applied to it. A cell can be selected if it exists and if it isn't on an empty / "Add New" row and if it is not marked as "unselectable" in the column definition.
* @param row A row index.
* @param col A column index.
* @return
**/
public canCellBeSelected(row: number, col: number): boolean;
/**
* Attempts to switch the active cell into edit mode. Will throw an error if the cell is set to be not editable. Uses the specified editor, otherwise defaults to any default editor for that given cell.
* @param editor A SlickGrid editor (see examples in slick.editors.js).
**/
public editActiveCell(editor: Editors.Editor<T>): void;
/**
* Flashes the cell twice by toggling the CSS class 4 times.
* @param row A row index.
* @param cell A column index.
* @param speed (optional) - The milliseconds delay between the toggling calls. Defaults to 100 ms.
**/
public flashCell(row: number, cell: number, speed?: number): void;
/**
* Returns an object representing the coordinates of the currently active cell: