-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTabulator.sbi
More file actions
1476 lines (1177 loc) · 55 KB
/
Tabulator.sbi
File metadata and controls
1476 lines (1177 loc) · 55 KB
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
; http://olifolkerd.github.io/tabulator/
DeclareModule Tabulator
EnumerationBinary ; EventTypes
; #############################
; Table Callbacks
; #############################
#EventType_TableBuilding = 1
#EventType_TableBuilt
; #############################
; Column Callbacks
; #############################
#EventType_ColumnHeaderClick
#EventType_ColumnHeaderDoubleClick
#EventType_ColumnHeaderRightClick
#EventType_ColumnMoved
#EventType_ColumnResized
#EventType_ColumnVisibilityChanged
#EventType_ColumnTitleChanged
; #############################
; Row Callbacks
; #############################
#EventType_RowClick
#EventType_RowDblClick
#EventType_RowContext
#EventType_RowAdded
#EventType_RowUpdated
#EventType_RowDeleted
#EventType_RowMoved
; #############################
; Cell Callbacks
; #############################
#EventType_CellClick
#EventType_CellDoubleClick
#EventType_CellRightClick
#EventType_CellEditing
#EventType_CellEditCancelled
#EventType_CellEdited
; #############################
; Data Callbacks
; #############################
#EventType_DataLoading
#EventType_DataLoaded
#EventType_DataEdited
#EventType_HTMLImporting
#EventType_HTMLImported
; #############################
; Ajax Callbacks
; #############################
#EventType_AjaxRequest
#EventType_AjaxResponse
#EventType_AjaxError
; #############################
; Filter Callbacks
; #############################
#EventType_DataFiltering
#EventType_DataFiltered
; #############################
; Sorting Callbacks
; #############################
#EventType_DataSorting
#EventType_DataSorted
; #############################
; Layout Callbacks
; #############################
#EventType_RenderStarted
#EventType_RenderComplete
; #############################
; Pagination Callbacks
; #############################
#EventType_PageLoaded
; #############################
; Localization Callbacks
; #############################
#EventType_TableLocalized
; #############################
; Group Callbacks
; #############################
#EventType_DataGrouping
#EventType_DataGrouped
#EventType_GroupVisibilityChanged
; #############################
; Selection Callbacks
; #############################
#EventType_RowSelected
#EventType_RowDeselected
#EventType_RowSelectionChanged
EndEnumeration
Enumeration ; Set- / GetGadgetAttribute
#TabulatorData
#TabulatorColumns
; #TabulatorOptions
EndEnumeration
Structure sColumn
; General
; title - Required This is the title that will be displayed in the header for this column
; field - Required (not required in icon/button columns) this is the key for this column in the data array
; visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details)
title.s
field.s
visible.i
; Layout
; align - sets the text alignment for this column (left|center|right)
; width - sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best)
; minWidth - sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth)
; widthGrow New - when using fitColumns layout mode, determines how much the column should grow to fill available space (see Table Layout for more details)
; widthShrink New - when using fitColumns layout mode, determines how much the column should shrink to fit available space (see Table Layout for more details)
; resizable New - set whether column can be resized by user dragging its edges (see Table Layout for more details)
; frozen - freezes the column in place when scrolling (see Frozen Columns for more details)
; responsive - an integer to determine when the column should be hidden in responsive mode (see Responsive Layout for more details)
; tooltip - sets the on hover tooltip for each cell in this column (see Formatting Data for more details)
; cssClass - sets css classes on header and cells in this column. (value should be a string containing space seperated class names)
; rowHandle - sets the column as a row handle, allowing it to be used to drag movable rows. (see Movable Rows for more details)
; hideInHtml - When the getHtml function is called, hide the column from the output.
align.s
width.i
minWidth.i
; widthGrow.i
; widthShrink.i
resizable.i
frozen.i
; responsive.i
tooltip.s
cssClass.s
; rowHandle.i
; hideInHtml.i
; Data Manipulation
; sorter - determines how to sort data in this column (see Sorting Data for more details)
; sorterParams - additional parameters you can pass to the sorter(see Sorting Data for more details)
; formatter - set how you would like the data to be formatted (see Formatting Data for more details)
; formatterParams - additional parameters you can pass to the formatter(see Formatting Data for more details)
; variableHeight -alter the row height to fit the contents of the cell instead of hiding overflow
; editable - callback to check if the cell is editable (see Manipulating Data for more details)
; editor - set the editor to be used when editing the data. (see Manipulating Data for more details)
; editorParams - additional parameters you can pass to the editor (see Manipulating Data for more details)
; validator - set the validator to be used to approve data when a user edits a cell. (see Manipulating Data for more details)
; mutator - function for manipulating column values as they are parsed into the table (see Mutators for more details)
; mutatorParams - additional parameters you can pass to the mutator(see Mutators for more details)
; mutatorData New - function for manipulating column values as they are parsed into the table by command (see Mutators for more details)
; mutatorDataParams New - additional parameters you can pass to the mutatorData(see Mutators for more details)
; mutatorEdit New - function for manipulating column values as they are edited by a user (see Mutators for more details)
; mutatorEditParams New - additional parameters you can pass to the mutatorEdit(see Mutators for more details)
; mutatorClipboard New - function for manipulating column values as they are pasted by a user (see Mutators for more details)
; mutatorClipboardParams New - additional parameters you can pass to the mutatorClipboard(see Mutators for more details)
; accessor - function to alter column values before they are extracted from the table function (see Accessors for more details)
; accessorParams - additional parameters you can pass to the accessor(see Accessors for more details)
; accessorData New - function to alter column values before they are extracted from the table using the getData function (see Accessors for more details)
; accessorDataParams New - additional parameters you can pass to the accessorData(see Accessors for more details)
; accessorDownload New - function to alter column values before they are included in a file download (see Accessors for more details)
; accessorDownloadParams New - additional parameters you can pass to the accessorDownload(see Accessors for more details)
; accessorClipboard New - function to alter column values before they are copied to the clipboard (see Accessors for more details)
; accessorClipboardParams New - additional parameters you can pass to the accessorClipboard(see Accessors for more details)
; download - show or hide column in downloaded data (see Downloading Table Data for more details)
; downloadTitle - set custom title for column in download (see Downloading Table Data for more details)
; topCalc - the column calculation to be displayed at the top of this column(see Column Calculations for more details)
; topCalcParams - additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details)
; topCalcFormatter - formatter for the topCalc calculation cell(see Column Calculations for more details)
; topCalcFormatterParams - additional parameters you can pass to the topCalcFormatter function(see Column Calculations for more details)
; bottomCalc - the column calculation to be displayed at the bottom of this column(see Column Calculations for more details)
; bottomCalcParams - additional parameters you can pass to the bottomCalc calculation function(see Column Calculations for more details)
; bottomCalcFormatter - formatter for the bottomCalc calculation cell(see Column Calculations for more details)
; bottomCalcFormatterParams - additional parameters you can pass to the bottomCalcFormatter function(see Column Calculations for more details)
sorter.s
; sorterParams.i
formatter.s
formatterParams.s
; variableHeight.i
; editable.i
; editor.i
; editorParams.i
; validator.i
; mutator.i
; mutatorParams.i
; mutatorData.i
; mutatorDataParams.i
; mutatorEdit.i
; mutatorEditParams.i
; mutatorClipboard.i
; mutatorClipboardParams.i
; accessor.i
; accessorParams.i
; accessorData.i
; accessorDataParams.i
; accessorDownload.i
; accessorDownloadParams.i
; accessorClipboard.i
; accessorClipboardParams.i
; download.i
; downloadTitle.i
; topCalc.i
; topCalcParams.i
; topCalcFormatter.i
; topCalcFormatterParams.i
; bottomCalc.i
; bottomCalcParams.i
; bottomCalcFormatter.i
; bottomCalcFormatterParams.i
; Cell Events
; cellClick - callback for when user clicks on a cell in this column (see Callbacks for more details)
; cellDblClick - callback for when user double clicks on a cell in this column (see Callbacks for more details)
; cellContext - callback for when user right clicks on a cell in this column (see Callbacks for more details)
; cellTap - callback for when user taps on a cell in this column, triggered in touch displays. (see Callbacks for more details)
; cellDblTap - callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. (see Callbacks for more details)
; cellTapHold - callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second. (see Callbacks for more details)
; cellEditing - callback for when a cell in this column is being edited by the user (see Callbacks for more details)
; cellEdited - callback for when a cell in this column has been edited by the user (see Callbacks for more details)
; cellEditCancelled - callback for when an edit on a cell in this column is aborted by the user (see Callbacks for more details)
; cellClick.i
; cellDblClick.i
; cellContext.i
; cellTap.i
; cellDblTap.i
; cellTapHold.i
; cellEditing.i
; cellEdited.i
; cellEditCancelled.i
; Column Headers
; headerSort - user can sort by clicking on the header (see Sorting Data for more details)
; headerSortStartingDir New - set the starting sort direction when a user first clicks on a header (see Sorting Data for more details)
; headerClick - callback for when user clicks on the header for this column (see Callbacks for more details)
; headerDblClick - callback for when user double clicks on the header for this column (see Callbacks for more details)
; headerContext - callback for when user right clicks on the header for this column (see Callbacks for more details)
; headerTap - callback for when user taps on a header for this column, triggered in touch displays. (see Callbacks for more details)
; headerDblTap - callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms. (see Callbacks for more details)
; headerTapHold - callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. (see Callbacks for more details)
; headerTooltip - sets the on hover tooltip for the column header (see Formatting Data for more details)
; editableTitle - allows the user to edit the header titles. (see Editable Column Titles for more details)
; titleFormatter - formatter function for header title (see Formatting Data for more details)
; titleFormatterParams - additional parameters you can pass to the header title formatter(see Formatting Data for more details)
; headerFilter - filtering of columns from elements in the header (see Header Filtering for more details)
; headerFilterPlaceholder - placeholder text for the header filter (see Header Filtering for more details)
; headerFilterParams - additional parameters you can pass to the header filter (see Header Filtering for more details)
; headerFilterFunc - the filter function that should be used by the header filter (see Header Filtering for more details)
; headerFilterFuncParams - additional parameters object passed to the headerFilterFunc function (see Header Filtering for more details)
; headerSort.i
; headerSortStartingDir.i
; headerClick.i
; headerDblClick.i
; headerContext.i
; headerTap.i
; headerDblTap.i
; headerTapHold.i
; headerTooltip.i
; editableTitle.i
; titleFormatter.i
; titleFormatterParams.i
; headerFilter.i
; headerFilterPlaceholder.i
; headerFilterParams.i
; headerFilterFunc.i
; headerFilterFuncParams.i
EndStructure
#Style_Tabulator = "tabulator.min.css"
#Style_Tabulator_Midnight = "tabulator_midnight.min.css"
#Style_Tabulator_Modern = "tabulator_modern.min.css"
#Style_Tabulator_Simple = "tabulator_simple.min.css"
#Style_Tabulator_Site = "tabulator_site.min.css"
#Style_Bootstrap = "bootstrap/tabulator_bootstrap.min.css"
#Style_SemanticUI = "semantic-ui/tabulator_semantic-ui.min.css"
#Sorter_String = "string"
#Sorter_Number = "number"
#Sorter_AlphaNum = "alphanum"
#Sorter_Date = "date"
#Sorter_Time = "time"
#Sorter_DateTime = "datetime"
#Sorter_Array = "array"
#Formatter_PlainText = "plaintext" ; plaintext - This is the default formatter for all cells, and simply displays the value of the cell as text.
#Formatter_TextArea = "textarea" ; textarea - shows text with carriage returns intact (great for multiline text), this formatter will also adjust the height of rows to fit the cells contents when columns are resized
#Formatter_Html = "html" ; html - displays un-sanitized html
#Formatter_Money = "money" ; money - formats a number into currency notation (eg. 1234567.8901 -> 1,234,567.89)
#Formatter_Image = "image" ; image - creates an img element wirh the src set as the value. (triggers the normalizeHeight function on the row on image load)
#Formatter_Link = "link" ; link - renders data as an anchor with a link to the given value (by default the value will be used as both the url and the label of the tag)
#Formatter_Tick = "tick" ; tick - displays a green tick if the value is (true|'true'|'True'|1) and an empty cell if not
#Formatter_TickCross = "tickCross" ; tickCross - displays a green tick if the value is (true|'true'|'True'|1) and a red cross if not
#Formatter_Color = "color" ; color - sets the background colour of the cell to the value. Can be any valid CSS color eg. #ff0000, #f00, rgb(255,0,0), red, rgba(255,0,0,0), hsl(0, 100%, 50%)
#Formatter_Star = "star" ; star - displays a graphical star rating based on integer values
#Formatter_Progress = "progress" ; progress Updated - displays a progress bar that fills the cell from left to right, using values 0-100 as a percentage of width
#Formatter_Lookup = "lookup" ; lookup - looks up the value to display from a object passed into the formatterParams property, if not present it displays the current cell value
#Formatter_ButtonTick = "buttonTick" ; buttonTick - displays a tick icon on each row (for use as a button)
#Formatter_ButtonCross = "buttonCross" ; buttonCross - displays a cross icon on each row (for use as a button)
#Formatter_RowNum = "rownum" ; rownum - shows an incrementing row number for each row.
#Formatter_Handle = "handle" ; handle - fills the cell with hamburger bars, to be used as a row handle
#Align_Left = "left"
#Align_Center = "center"
#Align_Right = "right"
Global IsInitialized
Declare Init(Callback, Style.s = #Style_Tabulator)
Declare BindGadget(Gadget, Options)
Declare BindTabulatorEvent(Gadget, Callback, EventType.q = #PB_All)
Declare UnbindTabulatorEvent(Gadget, Callback, EventType.q = #PB_All)
Declare GetSelectedData(Gadget)
Declare GetSelectedRows(Gadget)
Declare Redraw(Gadget)
Declare GetAttribute(Gadget, Attribute)
Declare SetAttribute(Gadget, Attribute, Value)
Declare SetAttribute2(Gadget, Attribute, List Value())
Declare ClearItems(Gadget)
Declare InitColumn(*Column.sColumn)
EndDeclareModule
Module Tabulator
Macro GetSelector
! var selector = $(spider_GadgetID(v_gadget).div).find('.dijitContentPane');
EndMacro
Procedure Init(Callback, Style.s = #Style_Tabulator)
! $('<link rel="stylesheet" type="text/css">').attr('href','./resources/tabulator/css/' + v_style).appendTo('head');
! require(["./resources/tabulator/js/jquery-ui.min.js"], function() {
! require(["./resources/tabulator/js/jquery.sparkline.min.js"], function() {
! require(["./resources/tabulator/js/tabulator.min.js"], function() {
IsInitialized = #True
! $.widget("ui.tabulator", $.ui.tabulator, {
! options: {
! resizableColumns: true,
! selectable: 1,
! height: '100%'
! }
! });
! v_callback();
! });
! });
! });
EndProcedure
Procedure InitColumn(*Column.sColumn)
; init this column with default-values
*Column\visible = #True
*Column\resizable = #True
*Column\align = #Align_Left
ProcedureReturn *Column
EndProcedure
Procedure BindGadget(Gadget, Options)
GetSelector
Protected eType.q
; #############################
; Table Callbacks
; #############################
;{-
; Table Building
; When a the tabulator constructor is called, the tableBuilding callback will triggered:
! v_options.tableBuilding = function() {
! if (typeof selector.data("tableBuilding") == 'function') {
eType = #EventType_TableBuilding
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("tableBuilding")();
! }
! };
; Table Built
; When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered:
! v_options.tableBuilt = function() {
! if (typeof selector.data("tableBuilt") == 'function') {
eType = #EventType_TableBuilt
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("tableBuilt")();
! }
! };
;}-
; #############################
; Column Callbacks
; #############################
;{-
; Column Header Click
; The headerClick callback is triggered when a user left clicks on a column or group header, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; column - column component
! // {title:"Name", field:"name", headerClick:function(e, column) { }, };
; Column Header Double Click
; The headerDblClick callback is triggered when a user double clicks on a column or group header, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; column - column component
! // {title:"Name", field:"name", headerDblClick:function(e, column) { }, };
; Column Header Right Click
; The headerContext callback is triggered when a user right clicks on a column or group header, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; column - column component
! // {title:"Name", field:"name", headerContext:function(e, column) { }, };
; Column Moved
; The columnMoved callback will be triggered when a column has been successfully moved.
; column - column component of the moved column
; columns- array of columns in new order
! v_options.columnMoved = function(column, columns) {
! if (typeof selector.data("columnMoved") == 'function') {
eType = #EventType_ColumnMoved
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("columnMoved")({ column:column, columns:columns });
! }
! };
; Column Resized
; The columnResized callback will be triggered when a column has been resized by the user.
; column - column component of the resized column
! v_options.columnResized = function(column) {
! if (typeof selector.data("columnResized") == 'function') {
eType = #EventType_ColumnResized
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("columnResized")({ column:column });
! }
! };
; Column Visibility Changed
; The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states.
; column - column component
; visible - is column visible (true = visible, false = hidden)
! v_options.columnVisibilityChanged = function(column, visible) {
! if (typeof selector.data("columnVisibilityChanged") == 'function') {
eType = #EventType_ColumnVisibilityChanged
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("columnVisibilityChanged")({ column:column, visible:visible });
! }
! };
; Column Title Changed
; The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array.
; column - column component
! v_options.columnTitleChanged = function(column) {
! if (typeof selector.data("columnTitleChanged") == 'function') {
eType = #EventType_ColumnTitleChanged
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("columnTitleChanged")({ column:column });
! }
! };
;}-
; #############################
; Row Callbacks
; #############################
;{-
; Row Click
; The rowClick callback is triggered when a user clicks on a row.
; e - the click event object
; row - row component
! v_options.rowClick = function(e, row) {
! if (typeof selector.data("rowClick") == 'function') {
eType = #EventType_RowClick
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowClick")({ e:e, row:row });
! }
! };
; Row Double Click
; The rowDblClick callback is triggered when a user double clicks on a row.
; e - the click event object
; row - row component
! v_options.rowDblClick = function(e, row) {
! if (typeof selector.data("rowDblClick") == 'function') {
eType = #EventType_RowDblClick
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowDblClick")({ e: e, row: row });
! }
! };
; Row Context Menu
; The rowContext callback is triggered when a user right clicks on a row.
; If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback.
; e - the click event object
; row - row component
! v_options.rowContext = function(e, row) {
! if (typeof selector.data("rowContext") == 'function') {
eType = #EventType_RowContext
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowContext")({ e: e, row: row });
! }
! e.preventDefault(); // prevent the browsers default context menu form appearing.
! };
; Row Added
; The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions.
; row - row component
! v_options.rowAdded = function(row) {
! if (typeof selector.data("rowAdded") == 'function') {
eType = #EventType_RowAdded
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowAdded")({ row: row });
! }
! };
; Row Updated
; The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions.
; row - row component
! v_options.rowUpdated = function(row) {
! if (typeof selector.data("rowUpdated") == 'function') {
eType = #EventType_RowUpdated
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowUpdated")({ row: row });
! }
! };
; Row Deleted
; The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function.
; row - row component
! v_options.rowDeleted = function(row) {
! if (typeof selector.data("rowDeleted") == 'function') {
eType = #EventType_RowDeleted
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowDeleted")({ row: row });
! }
! };
; Row Moved
; The rowMoved callback will be triggered when a row has been successfully moved.
; row - row component
! v_options.rowMoved = function(row) {
! if (typeof selector.data("rowMoved") == 'function') {
eType = #EventType_RowMoved
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("rowMoved")({ row: row });
! }
! };
;}-
; #############################
; Cell Callbacks
; #############################
;{-
; Cell Click
; The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; cell - cell component
! // {title:"Name", field:"name", cellClick = function(e, cell) { }, };
; Cell Double Click
; The cellDblClick callback is triggered when a user double clicks on a cell, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; cell - cell component
! // {title:"Name", field:"name", cellDblClick = function(e, cell) { }, };
; Cell Right Click
; The cellContext callback is triggered when a user right clicks on a cell, it can be set on a per column basis using the option in the columns data.
; e - the click event object
; cell - cell component
! // {title:"Name", field:"name", cellContext = function(e, cell) { }, };
; Cell Editing
; The cellEditing callback is triggered when a user starts editing a cell.
; cell - cell component
! v_options.cellEditing = function(cell) {
! if (typeof selector.data("cellEditing") == 'function') {
eType = #EventType_CellEditing
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("cellEditing")({ cell:cell });
! }
! };
; Cell Edit Cancelled
; The cellEditCancelled callback is triggered when a user aborts a cell edit and the cancel function is called.
; cell - cell component
! v_options.cellEditCancelled = function(cell) {
! if (typeof selector.data("cellEditCancelled") == 'function') {
eType = #EventType_CellEditCancelled
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("cellEditCancelled")({ cell:cell });
! }
! };
; Cell Edited
; The cellEdited callback is triggered when data in an editable cell is changed.
; cell - cell component
! v_options.cellEdited = function(cell) {
! if (typeof selector.data("cellEdited") == 'function') {
eType = #EventType_CellEdited
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("cellEdited")({ cell:cell });
! }
! };
;}-
; #############################
; Data Callbacks
; #############################
;{-
; Data Loading
; The dataLoading callback is triggered whenever new data is loaded into the table.
; data - the data loading into the table
! v_options.dataLoading = function(data) {
! if (typeof selector.data("dataLoading") == 'function') {
eType = #EventType_DataLoading
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataLoading")({ data:data });
! }
! };
; Data Loaded
; The dataLoaded callback is triggered when a new set of data is loaded into the table.
; data - all data loaded into the table
! v_options.dataLoaded = function(data) {
! if (typeof selector.data("dataLoaded") == 'function') {
eType = #EventType_DataLoaded
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataLoaded")({ data:data });
! }
! };
; Data Edited
; The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row.
; data - the updated table data
! v_options.dataEdited = function(data) {
! if (typeof selector.data("dataEdited") == 'function') {
eType = #EventType_DataEdited
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataEdited")({ data:data });
! }
! };
; HTML Importing
; The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table.
! v_options.htmlImporting = function() {
! if (typeof selector.data("htmlImporting") == 'function') {
eType = #EventType_HTMLImporting
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("htmlImporting")();
! }
! };
; HTML Imported
; The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table.
! v_options.htmlImported = function() {
! if (typeof selector.data("htmlImported") == 'function') {
eType = #EventType_HTMLImported
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("htmlImported")();
! }
! };
;}-
; #############################
; Ajax Callbacks
; #############################
;{-
; Ajax Request
; The ajaxRequesting callback is triggered when ever an ajax request is made.
; url - the URL of the request
; params - the parameters passed with the request
! v_options.ajaxRequesting = function(url, params) {
! if (typeof selector.data("ajaxRequesting") == 'function') {
eType = #EventType_AjaxRequest
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("ajaxRequesting")( { url:url, params:params } );
! }
! };
; Ajax Response
; The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table.
; If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered.
; url - the URL of the request
; params - the parameters passed with the request
; response - the JSON object returned in the body of the response.
! v_options.ajaxResponse = function(url, params, response) {
! if (typeof selector.data("ajaxResponse") == 'function') {
eType = #EventType_AjaxResponse
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("ajaxResponse")( { url:url, params:params, response:response } );
! }
! return response; //return the response data to tabulator
! };
; Ajax Error
; The ajaxError callback is triggered there is an error response to an ajax request.
; xhr - the XHR object
; textStatus - error type
; errorThrown - text portion of the HTTP status
! v_options.ajaxError = function(xhr, textStatus, errorThrown) {
! if (typeof selector.data("ajaxError") == 'function') {
eType = #EventType_AjaxError
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("ajaxError")( { xhr:xhr, textStatus:textStatus, errorThrown:errorThrown } );
! }
! };
;}-
; #############################
; Filter Callbacks
; #############################
;{-
; Data Filtering
; The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens.
; filters - array of filters currently applied
! v_options.dataFiltering = function(filters) {
! if (typeof selector.data("dataFiltering") == 'function') {
eType = #EventType_DataFiltering
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataFiltering")( { filters:filters } );
! }
! };
; Data Filtered
; The dataFiltered callback is triggered after the table dataset is filtered.
; filters - array of filters currently applied
; rows - array of row components that pass the filters
! v_options.dataFiltered = function(filters, rows) {
! if (typeof selector.data("dataFiltered") == 'function') {
eType = #EventType_DataFiltered
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataFiltered")( { filters:filters, rows:rows } );
! }
! };
;}-
; #############################
; Sorting Callbacks
; #############################
;{-
; Data Sorting
; The dataSorting callback is triggered whenever a sort event occurs, before sorting happens.
; sorters - an array of the sorters currently applied
! v_options.dataSorting = function(sorters) {
! if (typeof selector.data("dataSorting") == 'function') {
eType = #EventType_DataSorting
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataSorting")( { sorters:sorters } );
! }
! };
; Data Sorted
; The dataSorted callback is triggered after the table dataset is sorted.
; sorters - array of the sorters currently applied
; rows - array of row components in their new order
! v_options.dataSorted = function(sorters, rows) {
! if (typeof selector.data("dataSorted") == 'function') {
eType = #EventType_DataSorted
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataSorted")( { sorters:sorters, rows:rows } );
! }
! };
;}-
; #############################
; Layout Callbacks
; #############################
;{-
; Render Started
; The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include:
;
; Data is loaded into the table when setData is called
; A page is loaded through any form of pagination
; Rows are added to the table during progressive rendering
; Columns are changed by setColumns
; The data is filtered
; The data is sorted
; The redraw function is called
! v_options.renderStarted = function() {
! if (typeof selector.data("renderStarted") == 'function') {
eType = #EventType_RenderStarted
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("renderStarted")();
! }
! };
; Render Complete
; The renderComplete callback is triggered after the table has been rendered
! v_options.renderComplete = function() {
! if (typeof selector.data("renderComplete") == 'function') {
eType = #EventType_RenderComplete
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("renderComplete")();
! }
! };
;}-
; #############################
; Pagination Callbacks
; #############################
;{-
; Page Loaded
; Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument.
; pageno - the number of the loaded page
! v_options.pageLoaded = function(pageno) {
! if (typeof selector.data("pageLoaded") == 'function') {
eType = #EventType_PageLoaded
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("pageLoaded")( { pageno:pageno } );
! }
! };
;}-
; #############################
; Localization Callbacks
; #############################
;{-
; Table Localized
; When a localization event has occured, the localized callback will triggered, passing the current locale code and language object:
; locale - a string representing the current locale
; lang - the language object for the current locale
! v_options.localized = function(locale, lang) {
! if (typeof selector.data("localized") == 'function') {
eType = #EventType_TableLocalized
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("localized")( { locale:locale, lang:lang } );
! }
! };
;}-
; #############################
; Group Callbacks
; #############################
;{-
; Data Grouping
; The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens.
! v_options.dataGrouping = function() {
! if (typeof selector.data("dataGrouping") == 'function') {
eType = #EventType_DataGrouping
! spider.event.eventObject = v_gadget;
! spider.event.eventType = v_etype;
! selector.data("dataGrouping")();
! }
! };
; ; buggy (in combination with dojo?):
; ; Data Grouped
; ; The dataGrouped callback is triggered whenever a data grouping event occurs, after grouping happens.
; ; groups - array of group components
;
; ! v_options.dataGrouped = function(groups) {
; ! if (typeof selector.data("dataGrouped") == 'function') {
; eType = #EventType_DataGrouped
; ! spider.event.eventObject = v_gadget;
; ! spider.event.eventType = v_etype;
; ! selector.data("dataGrouped")( { groups:groups } );
; ! }